GLBasic User Manual

Main sections

bOR()

num% = bOR(num1%, num2%)



Performs the boolean OR operation on integer values. The numbers are 32bits in size.

bOR:

bOR compares the binary codes for num1% and num2% and if any bits are set to 1 in either num1% and num2%, they will appear in the result.

Binary code of num1% : 00100010
Binary code of num2% : 00100100
num1% bOR num2% : 00100110

Example:
FOR a%=0 TO 1
FOR b%=0 TO 1
x = (a+b*2)*160
PRINT "a="+a+" b="+b, x, 30

PRINT "bAND="+bAND(a, b), x, 60
PRINT "bOR ="+bOR (a, b), x, 80
PRINT "bXOR="+bXOR(a, b), x, 100
IF b=0 THEN PRINT "bNOT="+bNOT(a), x, 120
NEXT
NEXT
SHOWSCREEN
MOUSEWAIT


Output:
a=0 b=0 a=1 b=0 a=0 b=1 a=1 b=1

bAND=0 bAND=0 bAND=0 bAND=1
bOR=0 bOR=1 bOR=1 bOR=1
bXOR=0 bXOR=1 bXOR=1 bXOR=0
bNOT=-1

See also...