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

Function BigInt_Pow2

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

result = 2^exponent */

Source from the content-addressed store, hash-verified

861
862/* result = 2^exponent */
863static inline void
864BigInt_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

Callers 1

Dragon4Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected