Skip to content
FutureBlitz

    Install

    Import std.math.bits

    PopCount

    std.math.bits

    function

    Public Function PopCount<T: Integer>(value: T): Int

    How many of the value's bits are 1.

    Examples

    Expect(PopCount(0b1011) == 3)
    Expect(LeadingZeros(1 As UInt8) == 7)
    Expect(TrailingZeros(0b1000) == 3)

    std/math/bits.fb, line 56

    Report an issue with this page or with FutureBlitz on GitHub.