Code
Hub
Workspaces
Connect
Indexed graphs
Engine
MCP
copy
hub
/
github.com/jwasham/practice-python
/ get_bits
Function
get_bits
bit_manipulation/bits.py:43–44 ·
view source on GitHub ↗
(x, pos, n)
Source
from the content-addressed store, hash-verified
41
42
# Returns the n bits in bitfield starting at position pos
43
def
get_bits(x, pos, n):
44
return
(x >> (pos + 1 - n)) & ~(~0 << n)
45
46
47
def
set_bit(x, position):
Callers
1
main
Function · 0.85
Calls
no outgoing calls
Tested by
no test coverage detected