MCPcopy
hub / github.com/antlr/antlr4 / _bitCount

Method _bitCount

runtime/JavaScript/src/antlr4/misc/BitSet.js:113–122  ·  view source on GitHub ↗
(l)

Source from the content-addressed store, hash-verified

111 }
112
113 static _bitCount(l) {
114 // see https://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel
115 let count = 0;
116 l = l - ((l >> 1) & 0x55555555);
117 l = (l & 0x33333333) + ((l >> 2) & 0x33333333);
118 l = (l + (l >> 4)) & 0x0f0f0f0f;
119 l = l + (l >> 8);
120 l = l + (l >> 16);
121 return count + l & 0x3f;
122 }
123}

Callers 3

valuesMethod · 0.80
lengthMethod · 0.80
BitSetSpec.jsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected