Updated is_power_of_2 function. Old one was incorrect

Old implementation of is_power_of_2 was incorrect. E.g. it returned true on n=20