Documentation for routine msb
assembled from the following pages:
Class: Int §
From Int
(Int) routine msb §
Defined as:
multi method msb(Int:)multi sub msb(Int)
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»