working with binary numbers with bitwise operators
Dar Scott
dsc at swcp.com
Mon May 31 12:34:03 EDT 2004
On Monday, May 31, 2004, at 08:06 AM, MisterX wrote:
> I dont know if the value of the appended number
> is important but appending of numbers requires a
> base to base modulation
That might be convenient if eye-friendly intermediate values are
needed, that is, if intermediate values must look like long binary
numbers.
However, if numbers are kept in 24-bit chunks and two are used to
represent a 48-bit value, then the use of base conversion is not
needed. The results of bit-logical operators are numbers. They can be
paired with ",". (Numberformat is applied in that case.) They can
also be paired with binaryEncode and "&", but this can't reliably be
put into a field in debugging.
The bitwise logical operators are then applied to both halves to get a
logical result.
My understanding is that Alejandro is using binary numeral strings, eg
"011001110001010110", to accommodate shifting, so this does not apply.
(As I mentioned earlier, I think shifting as number is not so bad and
can be built up to apply to aggregates.)
I would use base conversion only for display.
Dar Scott
More information about the use-livecode
mailing list