1/* @title: Power of (integer) */
2#pragma once
3#include <stddef.h>
4#include <stdint.h>
5
6static inline size_t ipow(size_t base, int32_t exp) {
7 size_t result = 1;
8 while (exp > 0) {
9 if (exp & 1)
10 result *= base;
11 exp >>= 1;
12 base *= base;
13 }
14 return result;
15}
16
17static inline size_t pow2(size_t n) {
18 return 1ULL << n;
19}
20