MCPcopy
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
43def get_bits(x, pos, n):
44 return (x >> (pos + 1 - n)) & ~(~0 << n)
45
46
47def set_bit(x, position):

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected