BitCount
Revision as of 20:29, 31 December 2015 by Lchrisman (talk | contribs) (Created page with "category:Bit functions ''new to Analytica 4.7'' == BitCount(x'', which'') == Counts the number of 1 bits in the 64-bit integer portion of «x». The optional «whi...")
new to Analytica 4.7
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
Negative numbers are in 64-bit two's complement form, so that
BitCount(-1) → 64
BitCount( 0b1101010000, which:'-0')
→ 4BitCount( 0b1101010000, which:'0-')
→ 54BitCount( 0b1101010000, which:'-1')
→ 0BitCount( 0b1101011111, which:'-0')
→ 5BitCount( -256, which:'1-')
→ 56
See Also
Comments
Enable comment auto-refresher