HTBasic Help
×
Menu
Index

BINAND

Performs a bit by bit logical AND.
 
 BINAND( arg, arg )
 
Where:
arg = numeric-expression rounded to an INTEGER range -32768 to +32767
 
Usage:
I=BINAND(J,K)*6
IF BINAND(Low,4) THEN CALL Set
 
Example: BINAND.BAS
 
Description:
Use BINAND to clear or test specific bits. BINAND(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. Corresponding bits in A and B are then ANDed together. If both corresponding bits in A and B are a 1 the resulting bit is set to a 1 otherwise it is set to a 0. The following example:
 
BINAND(12,6)
 
performs a bit by bit logical AND of 12 with 6.
12           = 0000000000001100
6            = 0000000000000110
BINAND(12,6) = 0000000000000100
The resulting binary number represents 4.
 
See Also: