MCPcopy Create free account
hub / github.com/Effect-TS/effect / popcount

Function popcount

packages/effect/src/internal/hashMap/bitwise.ts:10–17  ·  view source on GitHub ↗
(x: number)

Source from the content-addressed store, hash-verified

8 * @internal
9 */
10export function popcount(x: number) {
11 x -= (x >> 1) & 0x55555555
12 x = (x & 0x33333333) + ((x >> 2) & 0x33333333)
13 x = (x + (x >> 4)) & 0x0f0f0f0f
14 x += x >> 8
15 x += x >> 16
16 return x & 0x7f
17}
18
19/** @internal */
20export function hashFragment(shift: number, h: number) {

Callers 1

fromBitmapFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…