X# uses the following Bitwise (binary) operators. There are simple character versions of these and also pseudo functions:
Operator |
Pseudo Function |
Example |
Meaning |
| |
_OR(..) |
x | y, _OR(x,y) |
Returns the bitwise OR of x and y |
~ |
_XOR(..) |
x ~ y, _XOR(x,y) |
Returns the bitwise XOR of x and y |
& |
_AND(..) |
x & y, _AND(x,y) |
Returns the bitwise AND of x and y. |
~ |
_NOT(..) |
~ x, _NOT(x) |
Returns the bitwise NOT of x (aka one's complement). _NOT() can only have one parameter |
The result of a bitwise operation is best understood via ‘truth tables’. If two numbers can, for instance, be defined by 4 bits (expressing numbers 0 up to 15 in decimal value) then, when ‘Anding’ them, use the AND truth table for each bit in turn. If the values in decimal are 5 and 1 then their bit representations are 0101 and 0001.