struct UInt16

Defined in:

remilib/extensions.cr:729
remilib/extensions.cr:765

Instance Method Summary

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) : Nil
prettySize(*, 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

def asBitSize(bits : Int, asUnsigned : Bool = false) : Int16 | UInt16 #

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).


[View source]
def numLeadingOnes : Int #

Returns the number of one bits in the number before a 0 bit is encountered.


[View source]
def numLeadingZeros : Int #

Returns the number of zero bits in the number before a 1 bit is encountered.


[View source]