Skip to content

fixedSIntBigUnsignedShiftRight

fixedSIntBigUnsignedShiftRight(value, count, bitWidth): bigint

Defined in: packages/math-numbers/src/fixed-int-big/fixed-sint-big-unsigned-shift-right.ts:20

Logical right shift of a bitWidth-bit two’s-complement integer: zeros fill from the left, so -1n at 8 bits shifted by one is 127n, not -1n.

This is the one right shift that needs bitWidth. “Fill with zeros from the left” presupposes a leftmost bit, and a bigint has none — a negative one behaves as an infinite run of sign bits. The width is what makes the top bit exist, so the value is read as a pattern, shifted, and read back.

bigint

The value to shift.

number

Bit positions to shift by; non-negative.

number

Width of the integer, in bits.

bigint

When count is negative or not a safe integer, or bitWidth is not a non-negative safe integer.