InternalReturns the bitwise AND of a and b.
First operand.
Second operand.
a & b as a bigint.
Returns the bitwise AND of a and ~b.
Same as combinator.and(a, combinator.not(b))
First operand.
Second operand.
a & ~b as a bigint.
Returns the bitwise NOT of a (one's complement inversion).
Value to invert.
~a as a bigint.
Returns the bitwise OR of a and b.
First operand.
Second operand.
a | b as a bigint.
Counts the number of set bits (population count) in a.
Unlike the number variant, negative bigint values cannot be
reinterpreted as unsigned because bigint has no fixed width and a
negative value conceptually has infinitely many set bits. Passing a
negative value throws a RangeError with the offending value
included in the message.
Non-negative value whose set bits are counted.
The count of bits set to 1 in a.
Shifts value left by shift bit positions.
The shift argument is a plain number and is converted to
BigInt(shift) internally. Unlike the number variant, there is no
31-bit cap — values shifted beyond bit 31 or bit 63 remain exact and
positive.
Value to shift.
Number of positions to shift left (no upper bound enforced).
value << BigInt(shift) as a bigint.
Returns the bitwise XOR of a and b.
First operand.
Second operand.
a ^ b as a bigint.
Implements Combinator for JavaScript's built-in
biginttype using native arbitrary-precision bitwise operators.Every operation delegates directly to JavaScript's
|,&,^,~and<<operators onbigintvalues. Unlike thenumber-based counterpart,bigintis not constrained to a fixed word size: the effective flag space is unbounded, and results are never truncated or sign-coerced by the engine.bigintuses two's complement with conceptually infinite precision: negative values represent an infinite sequence of leading1bits. This makesnotalways produce a negative result for any non-negative input, and makespopcountreject negative inputs rather than silently reinterpret them.