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.
Parameters
Section titled “Parameters”bigint
The value to count.
bitWidth
Section titled “bitWidth”number
Width of the integer, in bits.
Returns
Section titled “Returns”number
Throws
Section titled “Throws”When bitWidth is not a non-negative safe integer.