An abstract interface over a set of primitive bitwise operations for a given numeric type T.
T
The numeric type over which bitwise operations are performed. Must be either number or bigint (i.e. Bit).
number
bigint
Readonly
The identity element for or — a value with no bits set (0 or 0n).
or
0
0n
Returns the bitwise AND of a and b.
a
b
First operand.
Second operand.
a & b.
a & b
Returns the bitwise AND of a and ~b. Same as combinator.and(a, combinator.not(b))
~b
combinator.and(a, combinator.not(b))
a & ~b
Returns the bitwise NOT of a (one's complement inversion).
Value to invert.
~a.
~a
Returns the bitwise OR of a and b.
a | b.
a | b
Counts the number of bits set to 1 in a (population count).
1
Value whose set bits are counted.
The number of 1 bits in a.
Shifts value left by shift bit positions.
value
shift
Value to shift.
Number of positions to shift left.
value << shift.
value << shift
Returns the bitwise XOR of a and b.
a ^ b.
a ^ b
An abstract interface over a set of primitive bitwise operations for a given numeric type
T.