0.0.2 • Published 10 years ago

opaque-bitfield v0.0.2

Weekly downloads
2
License
-
Repository
github
Last release
10 years ago

opaque-bitfield

A bitfield where you can't see the insides

Overview

This is an implementation of a bitfield in JavaScript, for Node.JS. It's designed for minimal implementation leakage so that I can implement any kind of optimisations I like without breaking any consuming packages.

Right now the implementation is quite naiive, but I hope to improve it as time goes on.

Usage

var Bitfield = require("opaque-bitfield");

var bf = new Bitfield();

bf.set(0, true);

console.log(bf.get(0));

API

get

Bitfield.get(n);
var a = bf.get(0);

Arguments

  • n - the index of the value you want to get

Return Value

boolean value

set

Bitfield.set(n, v);
bf.set(0, true);
// field 0 is now true

Arguments

  • n - the index of the value you want to set
  • v - a boolean value

Return Value

Bitfield self

License

3-clause BSD. A copy is included with the source.

Contact