https://github.com/luanpotter/endless-bitset
Endless and fast BitSet implementation
https://github.com/luanpotter/endless-bitset
bigint bitset javascript
Last synced: about 1 year ago
JSON representation
Endless and fast BitSet implementation
- Host: GitHub
- URL: https://github.com/luanpotter/endless-bitset
- Owner: luanpotter
- License: mit
- Created: 2017-08-13T19:38:31.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-08-14T00:53:44.000Z (almost 9 years ago)
- Last Synced: 2025-03-11T11:06:46.601Z (over 1 year ago)
- Topics: bigint, bitset, javascript
- Language: JavaScript
- Size: 11.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# endless-bitset
[](https://travis-ci.org/luanpotter/endless-bitset)
An endless and fast bitset with some nice methods.
This is a wrapper around mattkrick's [fast-bitset](https://github.com/mattkrick/fast-bitset) that allows for unlimited sizes.
It uses [big-integer](https://github.com/peterolson/BigInteger.js) to access the higher indexes (but should work with plain old JS numbers for smaller indexes).
## Installation
With yarn:
`yarn add endless-bitset`
Or with npm:
`npm install endless-bitset --save`
## Features and Limitations
It's supposed to re-implement all methods from fast-bitset (they are a good selection), but I did just the ones I needed so far.
Technically, I guess it's limited by your RAM, your spare processing time and your call stack. But should be sufficient for most purposes.
## API
Currently implemented are these methods from the original API:
* BitSet
* new BitSet(nBitsOrKey) : only for integer or bitInt parameters
* .get(idx) ⇒ boolean
* .set(idx) ⇒ boolean
* .unset(idx) ⇒ boolean
* .setRange(from, to) ⇒ boolean
* .nextUnsetBit(idx) ⇒ number
I also added this property:
* BitSet
* length ⇒ integer : returns the max length, exactly as specified in the constructor
For the complete documentation, visit [fast-bitset](https://github.com/mattkrick/fast-bitset)'s readme.