This integer power is a use case where templates would result in much less code.
| 57 | |
| 58 | // This integer power is a use case where templates would result in much less code. |
| 59 | static 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 | |
| 75 | static inline void |
| 76 | _inline_ipow(npy_int8 base, npy_int8 exponent, npy_int8 &result) { |
no outgoing calls
no test coverage detected
searching dependent graphs…