In Int§

See primary documentation in context for routine msb

multi method msb(Int:D:)
multi        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␤»