HTBasic Help
×
Menu
Index

BINEOR

Performs a bit by bit exclusive OR (EXOR).
 
 BINEOR( arg, arg )
 
Where:
arg = numeric-expression rounded to an INTEGER
 
Usage:
M=BINEOR(J,K)
Toggle=BINEOR(Toggle,4)
 
Example: BINEOR.BAS
 
Description:
BINEOR is useful when you want to "toggle" a certain bit or bits. BINEOR(A,B) converts the values of A and B to integers. The integer values of A and B are then treated as unsigned binary numbers. Each bit of the result is set to 1 if exactly one of the corresponding bits for either A or B is 1 and is set to 0 if the corresponding bits of A and B are both 0 or both 1. An example of BINEOR follows:
 
BINEOR(12,6)
 
The numbers 12 and 6 are considered binary numbers, then the bitwise exclusive OR is performed.
 
12           = 0000000000001100
6            = 0000000000000110
BINEOR(12,6) = 0000000000001010
 
The resulting binary number represents 10.
See Also: