cross-platform compress & decompress
Wouter
wouter.abraham at pi.be
Wed Dec 3 18:48:53 EST 2003
On 03 Dec 2003, at 16:43, use-revolution-request at lists.runrev.com wrote:
> Message: 1
> Date: Wed, 3 Dec 2003 00:04:14 -0800
> From: Mark Brownell <gizmotron at earthlink.net>
> Subject: Re: cross-platform compress & decompress
> To: How to use Revolution <use-revolution at lists.runrev.com>
> Message-ID: <49526A81-2567-11D8-A2A2-000A95859272 at earthlink.net>
> Content-Type: text/plain; charset=US-ASCII; format=flowed
>
snip
>
> this is faster:
> put ((xL bitAnd 4278190080) / 16777216) into zp
> put (zp bitAnd 255) into a
> put ((xL bitAnd 16711680) / 65536) into b
> put ((xL bitAnd 65280) / 256) into c
> put (xL bitAnd 255) into d
>
> this is slower:
> put binaryDecode("CCCC",binaryEncode("I",xL),a,b,c,d) into
> numConverted
>
but this is still a bit faster:
put ((xL bitAnd 4278190080) / 16777216) bitAnd 255 into a ####
put ((xL bitAnd 16711680) / 65536) into b
put ((xL bitAnd 65280) / 256) into c
put (xL bitAnd 255) into d
> Mark
>
on mouseUp
## I added speed testing
put num2char("169,170,171,172") into x
## N - decode signed four-byte integers in network order
## put binaryDecode("N",x,halfBlock1) into numConverted
## I - decode unsigned four-byte integers in host order
put binaryDecode("I",x,halfBlock2) into numConverted
put halfBlock2 into xL
----
put the milliseconds into zap1
repeat with ii = 1 to 100000
put ((xL bitAnd 4278190080) / 16777216) into zp
put (zp bitAnd 255) into a
put ((xL bitAnd 16711680) / 65536) into b
put ((xL bitAnd 65280) / 256) into c
put (xL bitAnd 255) into d
end repeat
put the milliseconds into zap2
put zap2 - zap1 into t1
put the milliseconds into zap3
repeat with ii = 1 to 100000
put ((xL bitAnd 4278190080) / 16777216) bitAnd 255 into a ####
put ((xL bitAnd 16711680) / 65536) into b
put ((xL bitAnd 65280) / 256) into c
put (xL bitAnd 255) into d
end repeat
put the milliseconds into zap4
put zap4 - zap3 into t2
put halfblock2 && t1 && t2
## result = 2846534572 1406 1120
## second = 2846534572 1424 1115
/* yep my rig is slower :^) 400 mhz g4 Tibook */
end mouseUp
function num2char sx
repeat for each item i in sx
put numtochar(i) after z
end repeat
return z
end num2char
It is getting under the skin.
Greetings,
WA
More information about the use-livecode
mailing list