General Category > Ongoing Anim8or Development

ASL integer bit-wise operators

(1/4) > >>

Steve:
Build 1071 adds the integer bit-wise operators &, ^, |, << and >>. Since there is no unsigned int in ASL the right shift always sign extends.

Build 1075 adds bit negate ~, and ++ and --.

Note: Build 175 had a bug parsing prefix ++ and -- so it was replaced by build 1076.

Raxx:
Hey Steve,

Finally able to give these operators a shot (trying to implement this algorithm), but couldn't help but notice that the bit-wise NOT (~) operator is missing. Granted, it can be done manually, but it'd be awesome if it were in there.

Thanks

Claude:
Raxx

Until it's implemented,you could also apply XOR ^ between your integer and one which is all 1s to get the equivalent of a twiddle.

Hope it helps.
Claude

Raxx:
Hey Claude, makes perfect sense, totally ignored the XOR operator there.

I came up with this solution via code, but I'm wondering if there's a less intensive method of determining the all 1-bit integer. [edit]Scratch that

Claude:
How about something like this:
return $int  ^  0xffffffff;

Haven't tested it,but It should work.

Navigation

[0] Message Index

[#] Next page

Go to full version