function log2( x ) {
	var out = 0 >>> 0; // asm type annotation
	var y = x >>> 0; // asm type annotation

	// `x >= 65536`:
	if ( y & B4 ) {
		y >>>= S4;
		out |= S4;
	}
	// `x >= 256`:
	if ( y & B3 ) {
		y >>>= S3;
		out |= S3;
	}
	// `x >= 16`:
	if ( y & B2 ) {
		y >>>= S2;
		out |= S2;
	}
	// `x >= 4`:
	if ( y & B1 ) {
		y >>>= S1;
		out |= S1;
	}
	// `x >= 2`:
	if ( y & B0 ) {
		y >>>= S0;
		out |= S0;
	}
	return out;
}
Computes an integer binary logarithm (base two).

## Method

1.  Note that the largest unsigned 32-bit integer is `4294967295`, which is `2^{32}-1`. Hence, the integer binary logarithm cannot exceed `31` (i.e., `16 + 8 + 4 + 2 + 1`), which corresponds to the bit sequence

    ```binarystring
    00000000000000000000000000011111
    ```

2.  Initialize a return variable with the value zero.

3.  If at least one of the first sixteen most significant bits of the input 32-bit integer `x` is turned on, we know that the power to which the number `2` must be raised to obtain `x` is at least `16` (i.e., `x > 65536`). Hence, activate the corresponding bit of the return variable. Mutate `x` by shifting sixteen bits to the right, discarding the bits shifted off.

4.  Carry out the following steps with `B` in `[ 8, 4, 2, 1 ]`:

    -   If at least one of the next `B` most significant bits of the current `x` is turned on, we know that the power to which the number `2` must be raised to obtain `x` has to be increased by `B`.
    -   Activate the bit of the return variable that corresponds to `B`.
    -   Mutate `x` by shifting `B` bits to the right, discarding the bits shifted off.

5.  The final value of the return variable is the integer binary logarithm of `x`.

@param {uinteger32} x - input value
@returns {uinteger32} integer binary logarithm

@example
var v = log2( 4 >>> 0 );
// returns 2

@example
var v = log2( 8 >>> 0 );
// returns 3

@example
var v = log2( 9 >>> 0 );
// returns 3