baseConvert() & 32-bit ops

Mark Brownell gizmotron at earthlink.net
Sat Jun 21 23:17:00 EDT 2003


On Saturday, June 21, 2003, at 05:50  PM, Dar Scott wrote:

>
> On Saturday, June 21, 2003, at 05:05 PM, Mark Brownell wrote:
>
>> I don't see what to place into the local variable halfBlock
>>
>> -- my goal is to end up with this: 1181708909
>> -- from this:
>> put charToNum("m") + (charToNum("r") * 256 ) + ( charToNum("o") * 
>> 65536 ) + ( charToNum("F") * 16777216 )
>
> Hey, you changed order on me!  Actually, that is the order I prefer.
>
> The number is placed in halfBlock.  The function returns the number of 
> values converted.

This is fast and easy. I've never seen a function like this where the 
parameter seemed  empty and it worked that way. I like the way it 
returns 1 for error testing.

on mouseUp
   --put "This form needs to be filled out" into fld "textBox"
   put 1 into i
   repeat while i <= 32
     put char i to (i + 3) of fld "textBox" into zap
     put binaryDecode("N",zap,halfBlock) into numConverted
     put char 1 of zap into a
     put char 2 of zap into b
     put char 3 of zap into c
     put char 4 of zap into d
     put halfBlock & " -- " & charToNum(d) + (charToNum(c) * 256 ) + ( 
charToNum(b) * 65536 ) + ( charToNum(a) * 16777216 ) & return after 
field "icfield"
     put i + 4 into i
   end repeat




More information about the use-livecode mailing list