bitwisexor

From RPTools Wiki
Revision as of 13:07, 1 December 2008 by Craig (talk | contribs) (New page: ==Function bxor== Performs a bitwise 'exlusive or' operation of the number arguments by taking the binary representation of each of the numbers and performing the logical exclusive or oper...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Function bxor

Performs a bitwise 'exlusive or' operation of the number arguments by taking the binary representation of each of the numbers and performing the logical exclusive or operation on each of the bits.

Logical " exclusive or" Table

Bit1 Bit2 Result
0 0 0
0 1 1
1 1 0


Usage

[h: val = bxor(num, num, ...)]
[h: val = bitwisexor(num, num, ...)]

Examples

[r: bor(1,0)]

Returns 1.

[r: bor(1,1)]

Returns 0.

[r: bor(0,0)]

Returns 0.

[r: bor(2, 4]

Returns 6. 2 in binary is 010 and 4 in binary is 100, so a bitwise or of these two values is 110 which is 6 in decimal.

[r: band(6, 4)]

Returns 2. 6 in binary is 110 and 4 in binary is 100, so a bitwise or of these two values is 010 which is 2 in decimal.