开发者社区> 镜像站> NPM> popcnt32
popcnt32
Calculate population count (popcnt) on a 32-bit number, branch free
Last updated a year ago by emilbayes .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install popcnt32 
SYNC missed versions from official npm registry.

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

Current Tags

  • 1.0.0                                ...           latest (a year ago)

1 Versions

  • 1.0.0                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (2)
Dependents (1)