I wrote:
> Write a function to [...].  Compose them appropriately to set bits
> in numbers.  Probably four lines of code,

Turns out it's three lines of code:

  n2s = func(n) { var s = buf(6); setfld(s, 0, 48, n); return s; }
  getbit = func(n, b) { getfld(var s = n2s(n), b, 1) }
  setbit = func(n, b) { setfld(var s = n2s(n), b, 1); return fld(s, 0, 48); }

These guys provide 48 bits in a number.  You can theoretically stretch
that to 53, but it requires some fiddling of the doubles that I don't
want to promise yet. :)

Obviously you can't use this yet, because I haven't written the
underlying bit functions.  But hopefully this will address the
elegance issues.

Andy


_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d

Reply via email to