baseConvert() & 32-bit ops

Mark Brownell gizmotron at earthlink.net
Sun Jun 22 22:05:00 EDT 2003


On Sunday, June 22, 2003, at 05:55  PM, Mark Brownell wrote:

> Here is another possible optimization point.
> What can you and Rev do with this:
>
> xL = 0
> xL = bitXor( xL, bfP2[i] ) -- bfP2[i] = 1920723274
>   a = bitAnd( bitAnd( xL, -16777216 ) / 16777216, 255 ) + 1
>   b = ( bitAnd( xL, 16711680 ) / 65536 ) + 1
>   c = ( bitAnd( xL, 65280 ) / 256 ) + 1
>   d = bitAnd( xL, 255 ) + 1
>
> let me guess :
> put binaryDecode("N", bitXor( xL, 1920723274 ),a,b,c,d) into 
> numConverted
> or
> put binaryDecode("N", bitXor( xL, 1920723274 ),d,c,b,a) into 
> numConverted
>
> Mark

oops, not OOPs

I forgot to transpose from Lingo to Transcript,

   local xL
   put 0 into xL
   put xL bitXor 1920723274 into xL
   put ( xL bitAnd -16777216 ) / 16777216 into zap
   put ( zap bitAnd 255 ) + 1 into a
   put (( xL bitAnd 16711680 ) / 65536 ) + 1 into b
   put (( xL bitAnd 65280 ) / 256 ) + 1 into c
   put ( xL bitAnd 255 ) + 1 into d

   -- a = 1
   -- b = 124
   -- c = 234
   -- d = 75

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 1967 bytes
Desc: not available
URL: <http://lists.runrev.com/pipermail/use-livecode/attachments/20030622/601b0561/attachment.bin>


More information about the use-livecode mailing list