Combine base-2**n digits into an int. This function is the inverse of `_int2digits`. For more details, see _int2digits.
(digits, n)
| 494 | |
| 495 | |
| 496 | def _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 | |
| 511 | def _divmod_pos(a, b): |
no test coverage detected
searching dependent graphs…