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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


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

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

See Also

Comments


You are not allowed to post comments.