Could this make use of `num::next_power_of_two`?