leadingZeros

leadingZeros

> Functions

Returns the number of leading 0 bits of the integer x, that is, the bits 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 least significant bits out of 64.

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

Parameters
Return
Note