MCPcopy Index your code
hub / github.com/python/cpython / _digits2int

Function _digits2int

Lib/_pylong.py:496–508  ·  view source on GitHub ↗

Combine base-2**n digits into an int. This function is the inverse of `_int2digits`. For more details, see _int2digits.

(digits, n)

Source from the content-addressed store, hash-verified

494
495
496def _digits2int(digits, n):
497 """Combine base-2**n digits into an int. This function is the
498 inverse of `_int2digits`. For more details, see _int2digits.
499 """
500
501 def inner(L, R):
502 if L + 1 == R:
503 return digits[L]
504 mid = (L + R) >> 1
505 shift = (mid - L) * n
506 return (inner(mid, R) << shift) + inner(L, mid)
507
508 return inner(0, len(digits)) if digits else 0
509
510
511def _divmod_pos(a, b):

Callers 1

_divmod_posFunction · 0.85

Calls 1

innerFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…