popcnt32
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/popcnt32 package

1.0.0 • Public • Published

popcnt32

Calculate population count (popcnt) on a 32-bit number, branch free

Usage

var popcnt32 = require('popcnt32')
 
popcnt32(0b1) // 1
popcnt32(0b1000001) // 2

API

const ones = popcnt32(int)

Return number of 1-bits in int. Int is implicitly cast to a 32-bit unsigned int. This means popcnt32(-1) === 32 while popcnt32(1) === 1

Install

npm install popcnt32

License

ISC

/popcnt32/

    Package Sidebar

    Install

    npm i popcnt32

    Weekly Downloads

    10

    Version

    1.0.0

    License

    ISC

    Unpacked Size

    4.52 kB

    Total Files

    7

    Last publish

    Collaborators

    • emilbayes