implemented is_pow_of_two algorithm