result = 2^exponent */
| 861 | |
| 862 | /* result = 2^exponent */ |
| 863 | static inline void |
| 864 | BigInt_Pow2(BigInt *result, npy_uint32 exponent) |
| 865 | { |
| 866 | npy_uint32 bitIdx; |
| 867 | npy_uint32 blockIdx = exponent / 32; |
| 868 | npy_uint32 i; |
| 869 | |
| 870 | DEBUG_ASSERT(blockIdx < c_BigInt_MaxBlocks); |
| 871 | |
| 872 | for (i = 0; i <= blockIdx; ++i) { |
| 873 | result->blocks[i] = 0; |
| 874 | } |
| 875 | |
| 876 | result->length = blockIdx + 1; |
| 877 | |
| 878 | bitIdx = (exponent % 32); |
| 879 | result->blocks[blockIdx] |= ((npy_uint32)1 << bitIdx); |
| 880 | } |
| 881 | |
| 882 | /* |
| 883 | * This function will divide two large numbers under the assumption that the |