band, bnot, bor, bxor

band, bnot, bor, bxor — perform bitwise operations.

Syntax

band (number, number)
bnot (number)
bor (number, number)
bxor (number, number)

		

Arguments

number
Any number. Non-numbers are treated as zero.

Returns

An integer which is the result of the particular operation.

Description

The binary operations cast their arguments to integers, and then perform bitwise operations to produce an integer result.

  • band bitwise AND
  • bnot bitwise NOT (inversion of all bits in a 32-bit word)
  • bor bitwise OR
  • bxor bitwise exclusive OR (XOR)

Example

Gamma> band(7,5);
5
Gamma> bnot(7);
-8
Gamma> bor(7,5);
7
Gamma> bxor(7,5);
2
Gamma> 
		

See Also

Bitwise Operators