/* Returns true if n is a power of 2 */ static inline int is_power_of_2(uint32_t n) { return ((n-1) & n) == 0; }