BitCount
BitCount(x, which)
Counts the number of 1 bits in the 64-bit integer portion of «x».
The optional «which» parameter can be one of the following text values
'-0'
: Trailing (least significant) zero bits.'-1'
: Trailing 1s'0-'
: Leading (most significant) 0s.'1-'
: Leading 1s
Examples
BitCount(0) → 0
BitCount(13) → 3 { note: 13 = 0b1101 }
Negative numbers are in 64-bit two's complement form, so that
BitCount(-1) → 64
BitCount(0b1101010000, which: '-0') → 4
BitCount(0b1101010000, which: '0-') → 54
BitCount(0b1101010000, which: '-1') → 0
BitCount(0b1101011111, which: '-0') → 5
BitCount(-256, which: '1-') → 56
History
Introduced in Analytica 5.0.
See Also
Comments
Enable comment auto-refresher