Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

Futurebasic/Language/Reference/xor

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

XOR Syntax result& = exprA {XOR | ^^} exprB Description Expression exprA and expression exprB are each interpreted as 32-bit integer quantities. The XOR operator performs a "bitwise comparison" of each bit in exprA with the bit in the corresponding position in exprB. The result is another 32-bit quantity; each bit in the result is determined as follows: <image was here> A common use for XOR is to toggle the state of individual bits in a bit pattern. For example:    pattern& = pattern& XOR BIT(7) This flips bit 7 in pattern& from 0 to 1 or from 1 to 0, and leaves all of pattern&'s other bits alone. Example The example below shows how bits are manipulated with XOR: DEFSTR LONG PRINT BIN$(923) PRINT BIN$123) PRINT "--------------------------------" PRINT BIN$(923 XOR 123) program output: <code>00000000000000000000001110011011 00000000000000000000000001111011 -------------------------------- 00000000000000000000001111100000 See Also AND; OR; NOT