import math


def next_power_of_2(x):
    """Find the first power of 2 greater than x (x positive)"""
    assert x >= 0
    if x == 0:
        return 1
    else:
        return 2 ** math.ceil(math.log2(x))