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.


Flightgear-devel mailing list

Reply via email to