struct Int32
Defined in:
remilib/extensions.cr:729remilib/extensions.cr:765
Instance Method Summary
-
#asBitSize(bits : Int, asUnsigned : Bool = false) : Int32 | UInt32
Converts this integer to a number that is
bits
bits wide. -
#numLeadingOnes : Int
Returns the number of one bits in the number before a 0 bit is encountered.
-
#numLeadingZeros : Int
Returns the number of zero bits in the number before a 1 bit is encountered.
Instance methods inherited from struct Int
positiveSpokenNumber : String
positiveSpokenNumber,
prettySize(io : IO, *, alwaysShowAsBytes : Bool = false, decimalPlaces : Int = 2, separator : Char = '.', delimiter : Char = ',', padding : Int = 0, padChar : Char = ' ', shortSuffix : Bool = false) : NilprettySize(*, alwaysShowAsBytes : Bool = false, decimalPlaces : Int = 2, separator : Char = '.', delimiter : Char = ',', padding : Int = 0, padChar : Char = ' ', shortSuffix : Bool = false) : String prettySize, toRoman : String toRoman, toRoman? : String | Nil toRoman?, toSpoken : String toSpoken
Class methods inherited from struct Int
positiveSpokenNumber(num) : String
positiveSpokenNumber
Instance Method Detail
Converts this integer to a number that is bits
bits wide. If
asUnsigned
is true
, then the converted value is converted into an
unsigned integer of bits
size, otherwise it is converted to a
twos-complement signed integer of bits
size.
bits
must be at least 1. If bits
is greater than or equal to the
size of self
in bits, then self
is simply returned (possibly
converted to an unsigned version if asUnsigned
is true
).
Returns the number of one bits in the number before a 0 bit is encountered.
Returns the number of zero bits in the number before a 1 bit is encountered.