MCPcopy Create free account
hub / github.com/pydata/numexpr / _inline_ipow

Function _inline_ipow

numexpr3/real_functions.hpp:59–73  ·  view source on GitHub ↗

This integer power is a use case where templates would result in much less code.

Source from the content-addressed store, hash-verified

57
58// This integer power is a use case where templates would result in much less code.
59static inline void
60_inline_ipow(npy_uint8 base, npy_uint8 exponent, npy_uint8 &result) {
61 result = 1;
62 if (exponent <= 0) {
63 return;
64 }
65 npy_uint8 x = base; // Don't modify input args
66 npy_uint8 n = exponent;
67 while(n) {
68 if (n & 1)
69 result *= x;
70 n >>= 1;
71 x *= x;
72 }
73}
74
75static inline void
76_inline_ipow(npy_int8 base, npy_int8 exponent, npy_int8 &result) {

Callers 1

nr_int_powFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…