module Math

Extended Modules

Defined in:

ext/math.cr

Instance Method Summary

Instance Method Detail

def clz32(x : Int32) : Int32 #

Returns the number of leading zero bits in the 32-bit binary representation of a number.

#clz32 is short for CountLeadingZeroes32.

Math.clz32(1)    # => 31
Math.clz32(4)    # => 29
Math.clz32(1000) # => 22

[View source]