Skip to content

fixedSIntBigPopCount

fixedSIntBigPopCount(value, bitWidth): number

Defined in: packages/math-numbers/src/fixed-int-big/fixed-sint-big-pop-count.ts:18

Set bits in the bitWidth-bit two’s-complement pattern of value: -1n at 8 bits answers 8.

Distinct from @ac-kit/core’s bigIntPopCount, which counts the magnitude and would answer 1 for the same input. Both are right for what they are asked — an unbounded bigint has no finite two’s-complement pattern to count — and bitWidth is exactly what supplies the missing one.

bigint

The value to count.

number

Width of the integer, in bits.

number

When bitWidth is not a non-negative safe integer.