BitNor
The BitNor function returns the bit-wise NOR of two numbers. NOR means "NOT OR". This finds the bits that are not present in either number and sets them to 1 in the result.
nResult = BitNor( n1, n2 ) where |
nResult is the bit-wise NOR of n1 and n2.
n1 and n2 are two numbers (integers).
The bit-wise NOR of two numbers finds all bits that are 0 in both numbers and sets them to 1 in the result. For example, consider 7 NOR 18. In binary representation this is (111 NOR 10010). Only the bit at position 4 is 0 in both numbers, as are all high-order bits not shown. Bit 4 and the high-order bits are therefore set to 1 in the result. Thus (7 NOR 18) = 11111111111111111111111111101000 binary.
The following script performs the NOR of two numbers. Note that the result is printed using %u because it is considered an unsigned (i.e., 0 or positive) integer.
|
-- pick two numbers |
|
-- prints the result 4294967272 |