clz-buffer
Count leading zeros in a Buffer (clz)
Last updated 3 years ago by emilbayes .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install clz-buffer 
SYNC missed versions from official npm registry.

clz-buffer

Build Status

Count leading zeros in a Buffer (clz)

Usage

var clz = require('clz-buffer')

clz([0b00001000]) // === 4
clz([0b10000000]) // === 0
clz([0b10000000, 0]) // === 0
clz([0, 0]) // === 16
clz(Buffer.from([0, 0, 0])) // === 24

API

var n = clz(buf)

Counts the number of leading zeros. Stops at the first 1-bit. Works for any array-like type with values in the domain [0, 255].

Install

npm install clz-buffer

License

ISC

Current Tags

  • 1.0.0                                ...           latest (3 years ago)

1 Versions

  • 1.0.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 3
Dependencies (0)
None
Dev Dependencies (1)

Copyright 2014 - 2017 © taobao.org |