#include <types.h>
#include <math.h>
static int ps_of_two[12] = { 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096 };
bool is_low_power_of_two(int n)
{
for (int i = 0; i < 11; i++)
if (n == ps_of_two[i])
return true;
}
return false;
uint64_t int_pow(uint64_t base, uint32_t exp)
uint64_t result = 1;
while (exp)
if (exp & 1)
result *= base;
exp >>= 1;
base *= base;
return result;
int abs(int x)
return (x < 0) ? -x : x;