Melchior FRANZ wrote:
> Wouldn't work in my case. Would only make it even less
> elegant. Then I better stick with this:
Only if you don't want to write your own functions (in which case
every feature I don't want to support is going to be inelegant
and you'll never win until I turn Nasal into another monstrosity
like perl). Write a function to turn a number into a 4 byte
string (or more, you technically can do up to 6 in an IEEE
double). Write a function to set or get a bit in a string.
Write a function to turn a 4 byte string into a number. Compose
them appropriately to set bits in numbers. Probably four lines
of code, and you can do:
setprop(name, setbit(getprop(name), 2));
Look more elegant than bit twiddling to my eyes...
> The problem is that in joystick files I don't have the
> possibility to initialize bit fields or define bit operations.
Stick the bit stuff (which clearly isn't joystick-dependent) in
globals.nas. Problem solved.
Once again, bit operations on floating point numbers won't work
like you want them to. Think about implementing sign extension
in shifts, or rotations, or even (off the top of your head) tell
me how many bits are retained when you left shift.
Flightgear-devel mailing list