Melchior FRANZ wrote:
> I was thinking |A| (value of A), but I'm still hoping for binary
> ops, so this isn't a good idea. Function sounds good.
Bit operations as syntax aren't coming. All numbers in Nasal are
floating point, and don't mix nicely with bit twiddling. What
I'm thinking about instead is a "bits" package with functions
like:
bits.fld(string, startbit, len)
Returns the numeric value of a field of len bits starting
from the indicated start bit. Bit fields are always
treated in big-endian byte order (string[0] contains the
highest 8 bits).
bits.sfld(string, startbit, len)
Same deal, but treats the bitfield as a 2's complement
signed quantity and returns negative results where
appropriate.
bits.setfld(string, startbit, len, val)
Sets the field. Doesn't need a separate version for signed
vs. unsigned.
bits.buf(len)
Creates a new, mutable string filled with zeros.
bits.swap(str)
Reverses the order of all bytes in a string.
Andy
_______________________________________________
Flightgear-devel mailing list
[email protected]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d