MCPcopy Create free account
hub / github.com/numpy/numpy / BigInt_Multiply10

Function BigInt_Multiply10

numpy/core/src/multiarray/dragon4.c:526–546  ·  view source on GitHub ↗

result = result * 10 */

Source from the content-addressed store, hash-verified

524
525/* result = result * 10 */
526static void
527BigInt_Multiply10(BigInt *result)
528{
529 /* multiply all the blocks */
530 npy_uint64 carry = 0;
531
532 npy_uint32 *cur = result->blocks;
533 npy_uint32 *end = result->blocks + result->length;
534 for ( ; cur != end; ++cur) {
535 npy_uint64 product = (npy_uint64)(*cur) * 10ull + carry;
536 (*cur) = (npy_uint32)(product & bitmask_u64(32));
537 carry = product >> 32;
538 }
539
540 if (carry != 0) {
541 /* grow the array */
542 DEBUG_ASSERT(result->length + 1 <= c_BigInt_MaxBlocks);
543 *cur = (npy_uint32)carry;
544 ++result->length;
545 }
546}
547
548static npy_uint32 g_PowerOf10_U32[] =
549{

Callers 1

Dragon4Function · 0.85

Calls 1

bitmask_u64Function · 0.85

Tested by

no test coverage detected