MCPcopy Index your code
hub / github.com/MultithreadedJSBook/code-samples / setBool

Function setBool

ch4-serialization/booleans.js:3–5  ·  view source on GitHub ↗
(slot, value)

Source from the content-addressed store, hash-verified

1const buffer = new ArrayBuffer(1);
2const view = new Uint8Array(buffer);
3function setBool(slot, value) {
4 view[0] = (view[0] & ~(1 << slot)) | ((value|0) << slot);
5}
6function getBool(slot) {
7 return !((view[0] & (1 << slot)) === 0);
8}

Callers 1

booleans.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected