result = result * 2 */
| 501 | |
| 502 | /* result = result * 2 */ |
| 503 | static void |
| 504 | BigInt_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 */ |
| 526 | static void |