MCPcopy Create free account
hub / github.com/PageLeay/celestial-runtime / mask

Function mask

lib.commonjs/utils/maths.js:65–69  ·  view source on GitHub ↗

* Mask %%value%% with a bitmask of %%bits%% ones.

(_value, _bits)

Source from the content-addressed store, hash-verified

63 * Mask %%value%% with a bitmask of %%bits%% ones.
64 */
65function mask(_value, _bits) {
66 const value = getUint(_value, "value");
67 const bits = BigInt(getNumber(_bits, "bits"));
68 return value & ((BN_1 << bits) - BN_1);
69}
70exports.mask = mask;
71/**
72 * Gets a BigInt from %%value%%. If it is an invalid value for

Callers

nothing calls this directly

Calls 2

getUintFunction · 0.70
getNumberFunction · 0.70

Tested by

no test coverage detected