errorsparty.dev-bitifled
v1.0.0
Published
Turn a number into various radiusses.
Downloads
1
Readme
errorsparty.dev-bitfield
A bit less to write.
The next level bit manipulation module.
// Imports
import { Bitfield } from "errorsparty.dev-bitfield";
// Create a bitfield.
const myBitfield = new Bitfield();
// Do some stuff.
myBitfield.chain()
.set(0b1010)
.bxor(0b1101)
.get() // 0b111
The power comes with bitfield groups! Here's a little bit advanced example inspired by errorsparty.dev-snowflake module.
const noiseGroup = myBitfield.group(0, 16);
const incrementorGroup = myBitfield.group(16, 36);
const serviceGroup = myBitfield.group(36, 43);
const timestampGroup = myBitfield.group(43);
noiseGroup.set(randomValue(2));
incrementorGroup.set(incrementor);
serviceGroup.set(service);
timestampGroup.set(Date.now());
return myBitfield.get();