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

Function BigInt_Multiply2_inplace

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

result = result * 2 */

Source from the content-addressed store, hash-verified

501
502/* result = result * 2 */
503static void
504BigInt_Multiply2_inplace(BigInt *result)
505{
506 /* shift all the blocks by one */
507 npy_uint32 carry = 0;
508
509 npy_uint32 *cur = result->blocks;
510 npy_uint32 *end = result->blocks + result->length;
511 for ( ; cur != end; ++cur) {
512 npy_uint32 tmpcur = *cur;
513 *cur = (tmpcur << 1) | carry;
514 carry = tmpcur >> 31;
515 }
516
517 if (carry != 0) {
518 /* grow the array */
519 DEBUG_ASSERT(result->length + 1 <= c_BigInt_MaxBlocks);
520 *cur = carry;
521 ++result->length;
522 }
523}
524
525/* result = result * 10 */
526static void

Callers 1

Dragon4Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected