routine lsb
1 | class Int |
1.1 | (Int) routine lsb |
Documentation for routine lsb
assembled from the following types:
class Int
From Int
(Int) routine lsb
Defined as:
multi method lsb(Int:)multi sub lsb(Int)
Short for "Least Significant Bit". Returns Nil if the number is 0. Otherwise returns the zero-based index from the right of the least significant (rightmost) 1 in the binary representation of the number.
say 0b01011.lsb; # OUTPUT: «0»say 0b01010.lsb; # OUTPUT: «1»say 0b10100.lsb; # OUTPUT: «2»say 0b01000.lsb; # OUTPUT: «3»say 0b10000.lsb; # OUTPUT: «4»