MCPcopy Create free account
hub / github.com/Rich-Harris/magic-string / BitSet

Class BitSet

src/BitSet.ts:1–15  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1export default class BitSet {
2 declare bits: number[]
3
4 constructor(arg?: BitSet) {
5 this.bits = arg instanceof BitSet ? arg.bits.slice() : []
6 }
7
8 add(n: number): void {
9 this.bits[n >> 5] |= 1 << (n & 31)
10 }
11
12 has(n: number): boolean {
13 return !!(this.bits[n >> 5] & (1 << (n & 31)))
14 }
15}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected