Skip to content
/ bitset Public

Utilities for arithmetic bitwise operations in JavaScript

Notifications You must be signed in to change notification settings

hazae41/bitset

Repository files navigation

Bitset

DEPRECATED

Utilities for arithmetic bitwise operations in JavaScript

npm i @hazae41/bitset

Node Package 📦

Current features

  • 100% TypeScript and ESM
  • Unit-tested
  • Big-endian and little-endian
  • Export to uint32
  • Builder pattern

Usage

const bitset = new Bitset(0x00, 8)

const result = bitset
  .toggleLE(1) // 0000 0010
  .toggleBE(1) // 0100 0010
  .unsign() // >>> 0
  .value

const last6 = bitset
  .last(6) // 00 0010
  .toString() // "000010"