Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /mnt/web218/a3/28/510129628/htdocs/config.php on line 36 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /mnt/web218/a3/28/510129628/htdocs/config.php on line 37 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /mnt/web218/a3/28/510129628/htdocs/lang.php on line 55 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /mnt/web218/a3/28/510129628/htdocs/lang.php on line 55 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /mnt/web218/a3/28/510129628/htdocs/lang.php on line 110 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /mnt/web218/a3/28/510129628/htdocs/lang.php on line 110 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /mnt/web218/a3/28/510129628/htdocs/border_html5.php on line 201 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /mnt/web218/a3/28/510129628/htdocs/border_html5.php on line 201 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /mnt/web218/a3/28/510129628/htdocs/border_html5.php on line 216 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /mnt/web218/a3/28/510129628/htdocs/border_html5.php on line 216 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /mnt/web218/a3/28/510129628/htdocs/border_html5.php on line 231 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /mnt/web218/a3/28/510129628/htdocs/border_html5.php on line 232 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /mnt/web218/a3/28/510129628/htdocs/border_html5.php on line 232 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /mnt/web218/a3/28/510129628/htdocs/border_html5.php on line 233 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /mnt/web218/a3/28/510129628/htdocs/border_html5.php on line 233 GLBasic User Manual

GLBasic User Manual

Main sections

bXOR()

num% = bXOR(num1%, num2%)



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

bXOR:

bXOR compares the binary codes for num1% and num2% looking for differences. If the value of a binary bit in num1% differs to the corresponding binary bit in num2%, the resulting bit will be set to 1. If the bits are the same, the result will be 0.

Binary code of num1% : 00100010
Binary code of num2% : 00100100
num1% bXOR num2% : 00000110


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