use uint::next_power_of_two
attempt to fix integer overflow bugs when uint is 32bit