Core Function BitAND
From Sputnik Wiki
BitAND( <expression>, <expression2>, <n> )
Contents |
Description
Performs a bitwise AND operation.
Parameters
expression
The first number.
expression2
The second number.
n
Optional; The nth number - up to 255 values can be specified.
Return Value
Returns the value shifted by the required number of bits.
Bit operations are performed as 32-bit integers (INT32).
Remarks
Returns the value of the parameters bitwise-AND'ed together.
Some might wonder the point of such a function when clear & operators exist but why not!.
Example
$x = BitAND(13, 7); println($x); //x == 5 because 1101 AND 0111 = 0101 $x = BitAND(2, 3, 6); println($x); //x == 2 because 0010 AND 0011 AND 0110 = 0010 // Or maybe $x = 13 & 7; println($x); //x == 5 because 1101 AND 0111 = 0101 $x = 2 & 3 & 6; println($x); //x == 2 because 0010 AND 0011 AND 0110 = 0010