That formula is correct. I haven't been able to think of anything simpler. I prefer verbose function names and called mine round_up_to_a_power_of_two(). :)
"log(x)/log(2)" tells you to what power you'd need to raise 2 to get x
"ceil()" rounds it up to a whole number
"1 shl y" is a sneaky bitwise way to raise 2 to the power of y
"log(x)/log(2)" tells you to what power you'd need to raise 2 to get x
"ceil()" rounds it up to a whole number
"1 shl y" is a sneaky bitwise way to raise 2 to the power of y