Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

struct System.​UInt128

Assembly: System.Runtime

Implemented Interfaces

Represents a 128-bit unsigned integer.

Properties

public static UInt128
MaxValue
Gets the maximum value of the current type.
public static UInt128
MinValue
Gets the minimum value of the current type.
public static UInt128
One
Gets the value <c>1</c> for the type.
public static UInt128
Zero
Gets the value <c>0</c> for the type.

Methods

public static UInt128
BigMul​(UInt128 left, UInt128 right, UInt128& lower)
public static UInt128
Clamp​(UInt128 value, UInt128 min, UInt128 max)
Clamps a value to an inclusive minimum and maximum value.
Returns The result of clamping <paramref name="value" /> to the inclusive range of <paramref name="min" /> and <paramref name="max" /> .
value The value to clamp.
min The inclusive minimum to which <paramref name="value" /> should clamp.
max The inclusive maximum to which <paramref name="value" /> should clamp.
public int
CompareTo​(object value)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
Returns <para>A value that indicates the relative order of the objects being compared. The return value has these meanings:</para> <list type="table"> <listheader> <term>Value</term> <description>Meaning</description> </listheader> <item> <term>Less than zero</term> <description>This instance precedes <paramref name="value" /> in the sort order.</description> </item> <item> <term>Zero</term> <description>This instance occurs in the same position in the sort order as <paramref name="value" />.</description> </item> <item> <term>Greater than zero</term> <description>This instance follows <paramref name="value" /> in the sort order.</description> </item> </list>
value An object to compare with this instance.
public int
CompareTo​(UInt128 value)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
Returns <para>A value that indicates the relative order of the objects being compared. The return value has these meanings:</para> <list type="table"> <listheader> <term>Value</term> <description>Meaning</description> </listheader> <item> <term>Less than zero</term> <description>This instance precedes <paramref name="value" /> in the sort order.</description> </item> <item> <term>Zero</term> <description>This instance occurs in the same position in the sort order as <paramref name="value" />.</description> </item> <item> <term>Greater than zero</term> <description>This instance follows <paramref name="value" /> in the sort order.</description> </item> </list>
value An object to compare with this instance.
public static UInt128
CreateChecked​(TOther value)
Creates an instance of the current type from a value, throwing an overflow exception for any values that fall outside the representable range of the current type.
Returns An instance of <typeparamref name="TSelf" /> created from <paramref name="value" /> .
value The value that's used to create the instance of <typeparamref name="TSelf" /> .
public static UInt128
CreateSaturating​(TOther value)
Creates an instance of the current type from a value, saturating any values that fall outside the representable range of the current type.
Returns An instance of <typeparamref name="TSelf" /> created from <paramref name="value" /> , saturating if <paramref name="value" /> falls outside the representable range of <typeparamref name="TSelf" /> .
value The value that is used to create the instance of <typeparamref name="TSelf" /> .
public static UInt128
CreateTruncating​(TOther value)
Creates an instance of the current type from a value, truncating any values that fall outside the representable range of the current type.
Returns An instance of <typeparamref name="TSelf" /> created from <paramref name="value" /> , truncating if <paramref name="value" /> falls outside the representable range of <typeparamref name="TSelf" /> .
value The value that is used to create the instance of <typeparamref name="TSelf" /> .
public static ValueTuple<​UInt128, UInt128>
DivRem​(UInt128 left, UInt128 right)
Computes the quotient and remainder of two values.
Returns The quotient and remainder of <paramref name="left" /> divided-by <paramref name="right" /> .
left The value that <paramref name="right" /> divides.
right The value that divides <paramref name="left" /> .
public bool
Equals​(object obj)
Determines whether the specified object is equal to the current object.
Returns <see langword="true" /> if the specified object is equal to the current object; otherwise, <see langword="false" /> .
obj The object to compare with the current object.
public bool
Equals​(UInt128 other)
Indicates whether the current object is equal to another object of the same type.
Returns <see langword="true" /> if the current object is equal to the <paramref name="other" /> parameter; otherwise, <see langword="false" /> .
other An object to compare with this object.
public int
GetHashCode​()
Serves as the default hash function.
Returns A hash code for the current object.
public static bool
IsEvenInteger​(UInt128 value)
Determines if a value represents an even integral number.
Returns <see langword="true" /> if <paramref name="value" /> is an even integer; otherwise, <see langword="false" /> .
value The value to be checked.
public static bool
IsOddInteger​(UInt128 value)
Determines if a value represents an odd integral number.
Returns <see langword="true" /> if <paramref name="value" /> is an odd integer; otherwise, <see langword="false" /> .
value The value to be checked.
public static bool
IsPow2​(UInt128 value)
Determines if a value is a power of two.
Returns <see langword="true" /> if <paramref name="value" /> is a power of two; otherwise, <see langword="false" /> .
value The value to be checked.
public static UInt128
LeadingZeroCount​(UInt128 value)
Computes the number of leading zeros in a value.
Returns The number of leading zeros in <paramref name="value" /> .
value The value whose leading zeroes are to be counted.
public static UInt128
Log2​(UInt128 value)
Computes the log2 of a value.
Returns The log2 of <paramref name="value" /> .
value The value whose log2 is to be computed.
public static UInt128
Max​(UInt128 x, UInt128 y)
Compares two values to compute which is greater.
Returns <paramref name="x" /> if it is greater than <paramref name="y" /> ; otherwise, <paramref name="y" /> .
x The value to compare with <paramref name="y" /> .
y The value to compare with <paramref name="x" /> .
public static UInt128
Min​(UInt128 x, UInt128 y)
Compares two values to compute which is lesser.
Returns <paramref name="x" /> if it is less than <paramref name="y" /> ; otherwise, <paramref name="y" /> .
x The value to compare with <paramref name="y" /> .
y The value to compare with <paramref name="x" /> .
public static UInt128
Parse​(ReadOnlySpan<​byte> utf8Text, NumberStyles style = 7, IFormatProvider? provider = null)
Parses a span of UTF-8 characters into a value.
Returns The result of parsing <paramref name="utf8Text" /> .
utf8Text The span of UTF-8 characters to parse.
style A bitwise combination of number styles that can be present in <paramref name="utf8Text" /> .
provider An object that provides culture-specific formatting information about <paramref name="utf8Text" /> .
public static UInt128
Parse​(ReadOnlySpan<​byte> utf8Text, IFormatProvider? provider)
Parses a span of UTF-8 characters into a value.
Returns The result of parsing <paramref name="utf8Text" /> .
utf8Text The span of UTF-8 characters to parse.
provider An object that provides culture-specific formatting information about <paramref name="utf8Text" /> .
public static UInt128
Parse​(ReadOnlySpan<​char> s, NumberStyles style = 7, IFormatProvider? provider = null)
Parses a span of characters into a value.
Returns The result of parsing <paramref name="s" /> .
s The span of characters to parse.
style A bitwise combination of number styles that can be present in <paramref name="s" /> .
provider An object that provides culture-specific formatting information about <paramref name="s" /> .
public static UInt128
Parse​(ReadOnlySpan<​char> s, IFormatProvider? provider)
Parses a span of characters into a value.
Returns The result of parsing <paramref name="s" /> .
s The span of characters to parse.
provider An object that provides culture-specific formatting information about <paramref name="s" /> .
public static UInt128
Parse​(string s)
Parses a string into a value.
Returns The result of parsing <paramref name="s" /> .
s A string containing a number to parse.
public static UInt128
Parse​(string s, NumberStyles style)
Parses a string into a value.
Returns The result of parsing <paramref name="s" /> .
s A string containing a number to parse.
style A bitwise combination of number styles that can be present in <paramref name="s" /> .
public static UInt128
Parse​(string s, NumberStyles style, IFormatProvider? provider)
Parses a string into a value.
Returns The result of parsing <paramref name="s" /> .
s The string to parse.
style A bitwise combination of number styles that can be present in <paramref name="s" /> .
provider An object that provides culture-specific formatting information about <paramref name="s" /> .
public static UInt128
Parse​(string s, IFormatProvider? provider)
Parses a string into a value.
Returns The result of parsing <paramref name="s" /> .
s The string to parse.
provider An object that provides culture-specific formatting information about <paramref name="s" /> .
public static UInt128
PopCount​(UInt128 value)
Computes the number of bits that are set in a value.
Returns The number of set bits in <paramref name="value" /> .
value The value whose set bits are to be counted.
public static UInt128
RotateLeft​(UInt128 value, int rotateAmount)
Rotates a value left by a given amount.
Returns The result of rotating <paramref name="value" /> left by <paramref name="rotateAmount" /> .
value The value that is rotated left by <paramref name="rotateAmount" /> .
rotateAmount The amount by which <paramref name="value" /> is rotated left.
public static UInt128
RotateRight​(UInt128 value, int rotateAmount)
Rotates a value right by a given amount.
Returns The result of rotating <paramref name="value" /> right by <paramref name="rotateAmount" /> .
value The value that is rotated right by <paramref name="rotateAmount" /> .
rotateAmount The amount by which <paramref name="value" /> is rotated right.
public static int
Sign​(UInt128 value)
Computes the sign of a value.
Returns A positive value if <paramref name="value" /> is positive, <see cref="P:System.Numerics.INumberBase`1.Zero" /> if <paramref name="value" /> is zero, and a negative value if <paramref name="value" /> is negative.
value The value whose sign is to be computed.
public string
ToString​()
Returns a string that represents the current object.
Returns A string that represents the current object.
public string
ToString​(IFormatProvider? provider)
Converts the numeric value of this instance to its equivalent string representation using the specified culture-specific format information.
Returns The string representation of the value of this instance as specified by <paramref name="provider" /> .
provider An object that supplies culture-specific formatting information.
public string
ToString​(string format)
Converts the numeric value of this instance to its equivalent string representation, using the specified format.
Returns The string representation of the value of this instance as specified by <paramref name="format" /> .
format The format to use, or a <see langword="null" /> reference to use the default format defined for the type of the <see cref="T:System.IFormattable" /> implementation.
public string
ToString​(string format, IFormatProvider provider)
Formats the value of the current instance using the specified format.
Returns The value of the current instance in the specified format.
format The format to use, or a <see langword="null" /> reference to use the default format defined for the type of the <see cref="T:System.IFormattable" /> implementation.
provider An object that supplies culture-specific formatting information.
public static UInt128
TrailingZeroCount​(UInt128 value)
Computes the number of trailing zeros in a value.
Returns The number of trailing zeros in <paramref name="value" /> .
value The value whose trailing zeroes are to be counted.
public bool
TryFormat​(Span<​byte> utf8Destination, Int32& bytesWritten, ReadOnlySpan<​char> format = null, IFormatProvider? provider = null)
public bool
TryFormat​(Span<​char> destination, Int32& charsWritten, ReadOnlySpan<​char> format = null, IFormatProvider? provider = null)
public static bool
TryParse​(ReadOnlySpan<​byte> utf8Text, NumberStyles style, IFormatProvider? provider, UInt128& result)
public static bool
TryParse​(ReadOnlySpan<​byte> utf8Text, IFormatProvider? provider, UInt128& result)
public static bool
TryParse​(ReadOnlySpan<​byte> utf8Text, UInt128& result)
public static bool
TryParse​(ReadOnlySpan<​char> s, NumberStyles style, IFormatProvider? provider, UInt128& result)
public static bool
TryParse​(ReadOnlySpan<​char> s, IFormatProvider? provider, UInt128& result)
public static bool
TryParse​(ReadOnlySpan<​char> s, UInt128& result)
public static bool
TryParse​(string s, NumberStyles style, IFormatProvider provider, UInt128& result)
public static bool
TryParse​(string s, IFormatProvider provider, UInt128& result)
public static bool
TryParse​(string s, UInt128& result)
protected void
Finalize​()
Inherited from object
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
public Type
GetType​()
Inherited from object
Gets the <see cref="T:System.Type" /> of the current instance.
Returns The exact runtime type of the current instance.
protected object
MemberwiseClone​()
Inherited from object
Creates a shallow copy of the current <see cref="T:System.Object" /> .
Returns A shallow copy of the current <see cref="T:System.Object" /> .