UInt128

public struct UInt128

A 128-bit unsigned integer value type. Storage is based upon a tuple of 2, 64-bit unsigned integers.

  • max

    The largest value a UInt128 can hold.

    Declaration

    Swift

    public static var max: UInt128
  • min

    The smallest value a UInt128 can hold.

    Declaration

    Swift

    public static var min: UInt128
  • Returns size of data type in bits.

    Declaration

    Swift

    public static var _sizeInBits: Int32
  • Returns size of data type in bytes.

    Declaration

    Swift

    public static var _sizeInBytes: Int32
  • Internal value is presented as a tuple of 2 64-bit unsigned integers.

    Declaration

    Swift

    internal var value: (upperBits: UInt64, lowerBits: UInt64) = (0, 0)
  • Counts up the significant bits in stored data.

    Declaration

    Swift

    public var significantBits: UInt128
  • Returns the big-endian representation of the integer, changing the byte order if necessary.

    Declaration

    Swift

    public var bigEndian: UInt128
  • Returns the little-endian representation of the integer, changing the byte order if necessary.

    Declaration

    Swift

    public var littleEndian: UInt128
  • Returns the current integer with the byte order swapped.

    Declaration

    Swift

    public var byteSwapped: UInt128
  • Create a UInt128 instance from the supplied string.

    Requires

    string must match the following patterns: /0x[0-9a-fA-F]+/ for hexadecimal, /[0-9]+/ for decimal, /0o[0-7]+/ for octal or /0b[01]+/ for binary.

    Throws

    A UInt128Errors ErrorType.

    Declaration

    Swift

    internal static func fromUnparsedString(_ string: String) throws -> UInt128

    Parameters

    string

    A string representation of a number in one of the supported radix types (base 16, 10, 8 or 2).

    Return Value

    Returns a valid UInt128 instance.

  • Returns a newly instantiated UInt128 type from a pre-parsed and safe string. This should not be called directly, refer to fromUnparsedString for a proper front-end method.

    Requires

    string must match the pattern /[0-9a-z]+/.

    Throws

    A UInt128Errors ErrorType.

    Declaration

    Swift

    internal static func fromParsedString(_ string: String.UTF16View, radix: UInt8) throws -> UInt128

    Parameters

    string

    A string representation of a number in one of the supported radix types (base 2-36).

    radix

    The radix of the numbering system the string parameter is encoded by.

    Return Value

    Returns a valid UInt128 instance.

  • Undocumented

    Declaration

    Swift

    public struct UInt128
  • Undocumented

    Declaration

    Swift

    public struct UInt128
  • Undocumented

    Declaration

    Swift

    public struct UInt128
  • Undocumented

    Declaration

    Swift

    public struct UInt128
  • Undocumented

    Declaration

    Swift

    public struct UInt128
  • Creates an integer from its big-endian representation, changing the byte order if necessary.

    Declaration

    Swift

    public init(bigEndian value: UInt128)
  • Creates an integer from its little-endian representation, changing the byte order if necessary.

    Declaration

    Swift

    public init(littleEndian value: UInt128)
  • Converts the stored value into a string representation.

    Declaration

    Swift

    internal func toString(radix: Int = 10, uppercase: Bool = true) -> String

    Parameters

    radix

    The radix for the base numbering system you wish to have the type presented in.

    uppercase

    Determines whether letter components of the outputted string will be in uppercase format or not.

    Return Value

    String representation of the stored UInt128 value.

  • Declaration

    Swift

    public init(_ value: UIntMax)
  • Undocumented

    Declaration

    Swift

    public struct UInt128
  • Undocumented

    Declaration

    Swift

    public struct UInt128
  • Undocumented

    Declaration

    Swift

    public struct UInt128
  • Undocumented

    Declaration

    Swift

    public struct UInt128
  • Declaration

    Swift

    public func toUIntMax() -> UIntMax
  • Declaration

    Swift

    public var hashValue: Int
  • Undocumented

    Declaration

    Swift

    public struct UInt128
  • Undocumented

    Declaration

    Swift

    public struct UInt128
  • Returns an instance of UInt128 that is the current instance’s value increased by n when n is positive or decreased by n when n is negative.

    Declaration

    Swift

    public func advancedBy(_ n: Stride) -> UInt128
  • Returns the distance from the current UInt128 value to the supplied UInt128 value. This implementation is limited since a signed Int128 data type does not exist, so it has to fall back to an IntMax representation which lacks half of the storage space when end is less than the value of self.

    Declaration

    Swift

    public func distanceTo(_ end: UInt128) -> Stride
  • Declaration

    Swift

    public static var allZeros: UInt128
  • Declaration

    Swift

    public func toIntMax() -> IntMax
  • Declaration

    Swift

    public static func addWithOverflow(_ lhs: UInt128, _ rhs: UInt128) -> (UInt128, overflow: Bool)
  • Declaration

    Swift

    public static func subtractWithOverflow(_ lhs: UInt128, _ rhs: UInt128) -> (UInt128, overflow: Bool)
  • Declaration

    Swift

    public static func divideWithOverflow(_ lhs: UInt128, _ rhs: UInt128) -> (UInt128, overflow: Bool)
  • Declaration

    Swift

    public static func remainderWithOverflow(_ lhs: UInt128, _ rhs: UInt128) -> (UInt128, overflow: Bool)
  • Declaration

    Swift

    public static func multiplyWithOverflow(_ lhs: UInt128, _ rhs: UInt128) -> (UInt128, overflow: Bool)
  • Declaration

    Swift

    public var description: String