RETURNS THE BINARY LOGICAL "AND" BETWEEN THE VALUES V1 AND V2
ACTION
The function BIN_AND(V1,V2) returns the value of the binary logical "AND" between V1 and V2.
V1 and V2 are data or variables which can be real or integer.
If a value is real, it is rounded to the nearest integer before the logical operation.
The logical operation is made bit-by-bit:
1 AND 1 = 1
1 AND 0 = 0
0 AND 1 = 0
0 AND 0 = 0
Applications:
1 - to force a bit to 0
If the variable V1 has a value between 0 and 255, after V1=BIN_AND(V1,254), V1 has its last significant bit forced to 0, the other bits remain unchanged.
2 - to know a determined bit in an integer
BIN_AND(V1,1) gives the value of the last significant bit of V1.
SYNTAX:
Result=BIN_AND(V1,V2)
USE ERROR EXAMPLE
print bin_and(3,5)
print "Result = 1"
BIN_AND()
BIN_AND(V1,V2)
SEE ALSO
BIN_OR()
BIN_XOR()