Code
Hub
Workspaces
Connect
Indexed graphs
Engine
MCP
copy
hub
/
github.com/jwasham/practice-python
/ pop_count
Function
pop_count
bit_manipulation/bits.py:24–27 ·
view source on GitHub ↗
(i)
Source
from the content-addressed store, hash-verified
22
23
24
def
pop_count(i):
25
i -= ((i >> 1) & 0x55555555)
26
i = (i & 0x33333333) + ((i >> 2) & 0x33333333)
27
return
(((i + (i >> 4) & 0xF0F0F0F) * 0x1010101) & 0xffffffff) >> 24
28
29
30
def
is_bit_set(x, pos):
Callers
1
main
Function · 0.85
Calls
no outgoing calls
Tested by
no test coverage detected