@ficlabapp/bitfield

1.0.11 • Public • Published

Bitfield

A generic bitfield manipulation class, used to abstract defined parts of a BigInt as boolean or BigInt properties on an object.

Usage

// start with one integer property two bits wide at offset 4, initialised to zero
var b = new bitField({myProp: { offset: 4, size: 2 }, 0n);

// add a boolean property at offset 1
b.defineProperty("otherProp", 1);

// add another integer property two bits wide at offset 2
b.defineProperty("oneMoreProp", 2, 2);

// set some values
b.otherProp = true;
b.oneMoreProp = 3;

Readme

Keywords

none

Package Sidebar

Install

npm i @ficlabapp/bitfield

Weekly Downloads

0

Version

1.0.11

License

ISC

Unpacked Size

13.2 kB

Total Files

10

Last publish

Collaborators

  • erayd