def naive(x):
    """
    Compute the log base 2 of an unsigned 32-bit word

    Use the obvious way: O(N) operations
    Shift to the right `x` until `x` equals to zero.
    The log base 2 corresponds to the index of the most significant bit set.

    Parameters
    ----------
    x : int
        The unsigned 32-bit word to find the log base 2 of.

    References
    ----------
    .. [1] https://graphics.stanford.edu/~seander/bithacks.html#IntegerLogObvious

    Returns
    -------
    int
        The log base 2 of `x`
    """
    if x < 0:
        raise ValueError('x has to be positive')
    r = -1
    while x:
        r += 1
        x >>= 1
    return r
