leadingZeros

leadingZeros

> Functions

Returns the number of 0 bits at the start of the integer x, that is before its first 1 bit starting from the most significant bit. The count is always done over the 64 bits of a signed integer: leadingZeros(8) returns 60, because 8 is written 1000 and occupies the 4 low-order bits out of 64.

Returns 64 when x* is 0, and 0 when *x is negative, since its sign bit is set. For a positive number, leadingZeros(x) + bitLength(x) is always 64.

Parameters
Return
Note