fast-bitfield

WebJar for fast-bitfield

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

fast-bitfield
Last Version

Last Version

1.2.2
Release Date

Release Date

Type

Type

jar
Description

Description

fast-bitfield
WebJar for fast-bitfield
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/mafintosh/fast-bitfield

Download fast-bitfield

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/fast-bitfield/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>fast-bitfield</artifactId>
    <version>1.2.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/fast-bitfield/
implementation 'org.webjars.npm:fast-bitfield:1.2.2'
// https://jarcasting.com/artifacts/org.webjars.npm/fast-bitfield/
implementation ("org.webjars.npm:fast-bitfield:1.2.2")
'org.webjars.npm:fast-bitfield:jar:1.2.2'
<dependency org="org.webjars.npm" name="fast-bitfield" rev="1.2.2">
  <artifact name="fast-bitfield" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='fast-bitfield', version='1.2.2')
)
libraryDependencies += "org.webjars.npm" % "fast-bitfield" % "1.2.2"
[org.webjars.npm/fast-bitfield "1.2.2"]

Dependencies

compile (1)

Group / Artifact Type Version
org.webjars.npm : count-trailing-zeros jar [1.0.1,2)

Project Modules

There are no modules declared in this project.

fast-bitfield

A variable sized bitfield (based on indexed-bitfield) that allows you to quickly iterate over the bits.

npm install fast-bitfield

Allocates a series of ~4kb bitfields (when needed) to store the underlying data efficiently.

Usage

const bitfield = require('fast-bitfield')

const bits = bitfield()

bits.set(1000, true)
bits.set(1000000000, true)

const ite = bits.iterator()

console.log(ite.next(true)) // 1000
console.log(ite.next(true)) // 1000000000
console.log(ite.next(true)) // -1

API

bits = bitfield()

Make a new fast bitfield

updated = bits.set(index, bool)

Set a bit.

Runs in O(log32(maxBitIndex)) worst case but often O(1)

bool = bits.get(index)

Get a bit.

Runs in O(log32(maxBitIndex))

bits.fill(val, [start], [end])

Set a range of bits efficiently.

iterator = bits.iterator()

Make a new bit iterator.

iterator.seek(index)

Move the iterator to start at index.

Runs in O(log32(maxBitIndex))

index = iterator.next(bit)

Returns the index of the next bit and -1 if none can be found.

Runs in O(log32(distanceToNextBit))

License

MIT

Versions

Version
1.2.2