MCPcopy Create free account
hub / github.com/apple/foundationdb / _bit_length

Function _bit_length

bindings/python/fdb/tuple.py:302–305  ·  view source on GitHub ↗
(x)

Source from the content-addressed store, hash-verified

300
301if sys.version_info < (2, 7):
302 def _bit_length(x):
303 s = bin(x) # binary representation: bin(-37) --> '-0b100101'
304 s = s.lstrip('-0b') # remove leading zeros and minus sign
305 return len(s)
306else:
307 def _bit_length(x):
308 return x.bit_length()

Callers 1

_encodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected