A collection of low-level, static Int manipulation helper functions.

Static methods

staticbitLen(x:Int):Int

Calculates the bit length of a signed 32-bit integer.

Parameters:

x

The integer value.

Returns:

The number of bits required to represent x.

staticclp2(x:Int32):Int

"Ceiling power of two" -- round up to the least power of two greater than or equal to input x, which is interpreted as unsigned.

staticnlz(x:Int):Int

"Numbler of leading zeros" - return the number of leading 0-value bits in the binary representation of x.

Parameters:

x

The integer to inspect.

Returns:

The count of leading zeros.

staticntz(x:Int32):Int

Number of trailing zeros - return the number of trailing 0-value bits

staticu32divu16(dividend:Int32, divisor:Int32):Int

Integer division of unsigned 32-bit integer by unsigned 16-bit integer.

Result is undefined when divisor <= 0 or divisor >= 2^16.

staticinlineu32geu32(a:Int, b:Int):Bool

Unsigned greater than or equal comparison. Returns true if a >= b when both a and b are interpreted as unsigned integers; false otherwise.

staticinlineu32gtu32(a:Int, b:Int):Bool

Unsigned greater than comparison.

Returns true if a > b when both a and b are interpreted as unsigned integers; false otherwise.