Code
Hub
Workspaces
Connect
Indexed graphs
Engine
MCP
copy
hub
/
github.com/jwasham/practice-python
/ is_power_of_2
Function
is_power_of_2
bit_manipulation/bits.py:38–39 ·
view source on GitHub ↗
(x)
Source
from the content-addressed store, hash-verified
36
37
38
def
is_power_of_2(x):
39
return
(x & x - 1) == 0
40
41
42
# Returns the n bits in bitfield starting at position pos
Callers
1
main
Function · 0.85
Calls
no outgoing calls
Tested by
no test coverage detected