def next_power_of_two(x):
    # type: (int) -> int
    """
    Compute the next power of two that is greater than `x`:
        >>> next_power_of_two(0)
        1
        >>> next_power_of_two(1)
        2
        >>> next_power_of_two(2)
        4
        >>> next_power_of_two(3)
        4
        >>> next_power_of_two(4)
        8
    """
    s = 1
    while x & (x + 1) != 0:
        x |= x >> s
        s *= 2
    return x + 1