msb
ErrorsCollection

msb

Synthesised documentation from type/Int

From type/Int

See Original text in context

multi method msb(Int:D:)
multi sub    msb(Int:D)

Short for "Most Significant Bit". Returns Nil if the number is 0. Otherwise returns the zero-based index from the right of the most significant (leftmost) 1 in the binary representation of the number.

say 0b00001.msb;        # OUTPUT: «0␤» 
say 0b00011.msb;        # OUTPUT: «1␤» 
say 0b00101.msb;        # OUTPUT: «2␤» 
say 0b01010.msb;        # OUTPUT: «3␤» 
say 0b10011.msb;        # OUTPUT: «4␤»