#pragma once template bool is_pow_of_two(Int n){ return n && !(n & (n - 1)); } template bool is_even(Int n){ return (n & 1) == 0; } // calculates integer 2-log such that: // 2^(two_log(x)) >= x > 2^(two_log(x) - 1) inline unsigned int two_log(unsigned int x){ if(x <= 1) return 0; return 8*sizeof(unsigned int) - unsigned(__builtin_clz(x-1)); }