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

   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

   bits.setfld(string, startbit, len, val)
      Sets the field.  Doesn't need a separate version for signed
      vs. unsigned.

       Creates a new, mutable string filled with zeros.

       Reverses the order of all bytes in a string.


Flightgear-devel mailing list

Reply via email to