GLBasic User Manual

Main sections

bNOT()

num% = bNOT(num1%)



Performs the boolean NOT operations on an integer value. The number is 32bits in size.

bNOT:

bNOT reverses the binary bits of num1%. Any bit set to 1 in num1% will be set to 0 in the result and vice versa.

Binary code of num1% : 00100010
bNOT num1% : 11011101

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...