use next_power_of_two. attempt to fix overflow issues when int is 32bit