[#absl-uint128]
= xref:absl.adoc[absl]::uint128
:relfileprefix: ../
:mrdocs:

An unsigned 128&hyphen;bit integer type&period;

== Synopsis

Declared in `&lt;absl&sol;numeric&sol;int128&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class uint128;
----

== Description

The API is meant to mimic an intrinsic type as closely as is practical, including exhibiting undefined behavior in analogous cases (e&period;g&period; division by zero)&period; This type is intended to be a drop&hyphen;in replacement once C&plus;&plus; supports an intrinsic `uint128&lowbar;t` type&semi; when that occurs, existing well&hyphen;behaved uses of `uint128` will continue to work using that new type&period;

Note&colon; code written with this type will continue to compile once `uint128&lowbar;t` is introduced, provided the replacement helper functions `Uint128(Low&verbar;High)64()` and `MakeUint128()` are made&period;

A `uint128` supports the following&colon;

&ast; Implicit construction from integral types &ast; Explicit conversion to integral types

Additionally, if your compiler supports `&lowbar;&lowbar;int128`, `uint128` is interoperable with that type&period; (Abseil checks for this compatibility through the `ABSL&lowbar;HAVE&lowbar;INTRINSIC&lowbar;INT128` macro&period;)

However, a `uint128` differs from intrinsic integral types in the following ways&colon;

&ast; Errors on implicit conversions that do not preserve value (such as loss of precision when converting to float values)&period; &ast; Requires explicit construction from and conversion to floating point types&period; &ast; Conversion to integral types requires an explicit `static&lowbar;cast()` to mimic use of the `&hyphen;Wnarrowing` compiler flag&period; &ast; The alignment requirement of `uint128` may differ from that of an intrinsic 128&hyphen;bit integer type depending on platform and build configuration&period;

Example&colon;

float y &equals; absl&colon;&colon;Uint128Max()&semi; &sol;&sol; Error&period; uint128 cannot be implicitly &sol;&sol; converted to float&period;

absl&colon;&colon;uint128 v&semi; uint64&lowbar;t i &equals; v&semi; &sol;&sol; Error uint64&lowbar;t i &equals; static&lowbar;cast&lt;uint64&lowbar;t&gt;(v)&semi; &sol;&sol; OK

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:absl/uint128/2constructor-00.adoc[`uint128`]         [.small]#[constructor]#
| Constructors
| xref:absl/uint128/operator_assign-0c.adoc[`operator&equals;`] 
| Assignment operators
| xref:absl/uint128/operator_mod_eq.adoc[`operator%&equals;`] 
| Divides this value by `other` and stores the remainder in place&period;
| xref:absl/uint128/operator_and_eq.adoc[`operator&amp;&equals;`] 
| Applies a bitwise AND with `other` and stores the result in place&period;
| xref:absl/uint128/operator_star_eq.adoc[`operator&ast;&equals;`] 
| Multiplies this value by `other` and stores the result in place&period;
| xref:absl/uint128/operator_inc-02.adoc[`operator&plus;&plus;`] 
| Increment operators
| xref:absl/uint128/operator_plus_eq.adoc[`operator&plus;&equals;`] 
| Adds `other` to this value and stores the result in place&period;
| xref:absl/uint128/operator_dec-046.adoc[`operator&hyphen;&hyphen;`] 
| Decrement operators
| xref:absl/uint128/operator_minus_eq.adoc[`operator&hyphen;&equals;`] 
| Subtracts `other` from this value and stores the result in place&period;
| xref:absl/uint128/operator_slash_eq.adoc[`operator&sol;&equals;`] 
| Divides this value by `other` and stores the quotient in place&period;
| xref:absl/uint128/operator_lshift_eq.adoc[`operator&lt;&lt;&equals;`] 
| Shifts this value left by the given number of bits in place&period;
| xref:absl/uint128/operator_rshift_eq.adoc[`operator&gt;&gt;&equals;`] 
| Shifts this value right by the given number of bits in place&period;
| xref:absl/uint128/operator_xor_eq.adoc[`operator&circ;&equals;`] 
| Applies a bitwise XOR with `other` and stores the result in place&period;
| xref:absl/uint128/operator_or_eq.adoc[`operator&verbar;&equals;`] 
| Applies a bitwise OR with `other` and stores the result in place&period;
| xref:absl/uint128/2conversion-0e.adoc[`operator &lowbar;&lowbar;int128`] 
| Converts this `uint128` to a signed `&lowbar;&lowbar;int128`&period;
| xref:absl/uint128/2conversion-04c.adoc[`operator bool`] 
| Converts this `uint128` to a `bool`&period;
| xref:absl/uint128/2conversion-00.adoc[`operator char`] 
| Converts this `uint128` to a `char`, keeping the low bits&period;
| xref:absl/uint128/2conversion-037.adoc[`operator char16&lowbar;t`] 
| Converts this `uint128` to a `char16&lowbar;t`, keeping the low bits&period;
| xref:absl/uint128/2conversion-0f1.adoc[`operator char32&lowbar;t`] 
| Converts this `uint128` to a `char32&lowbar;t`, keeping the low bits&period;
| xref:absl/uint128/2conversion-0c.adoc[`operator double`] 
| Converts this `uint128` to a `double`&period;
| xref:absl/uint128/2conversion-022.adoc[`operator float`] 
| Converts this `uint128` to a `float`&period;
| xref:absl/uint128/2conversion-082.adoc[`operator int`] 
| Converts this `uint128` to an `int`, keeping the low bits&period;
| xref:absl/uint128/2conversion-05.adoc[`operator long`] 
| Converts this `uint128` to a `long`, keeping the low bits&period;
| xref:absl/uint128/2conversion-028.adoc[`operator long double`] 
| Converts this `uint128` to a `long double`&period;
| xref:absl/uint128/2conversion-083.adoc[`operator long long`] 
| Converts this `uint128` to a `long long`, keeping the low bits&period;
| xref:absl/uint128/2conversion-0fc.adoc[`operator short`] 
| Converts this `uint128` to a `short`, keeping the low bits&period;
| xref:absl/uint128/2conversion-09b.adoc[`operator signed char`] 
| Converts this `uint128` to a `signed char`, keeping the low bits&period;
| xref:absl/uint128/2conversion-01f.adoc[`operator unsigned &lowbar;&lowbar;int128`] 
| Converts this `uint128` to an `unsigned &lowbar;&lowbar;int128`&period;
| xref:absl/uint128/2conversion-039.adoc[`operator unsigned char`] 
| Converts this `uint128` to an `unsigned char`, keeping the low bits&period;
| xref:absl/uint128/2conversion-01a.adoc[`operator unsigned int`] 
| Converts this `uint128` to an `unsigned int`, keeping the low bits&period;
| xref:absl/uint128/2conversion-099.adoc[`operator unsigned long`] 
| Converts this `uint128` to an `unsigned long`, keeping the low bits&period;
| xref:absl/uint128/2conversion-041.adoc[`operator unsigned long long`] 
| Converts this `uint128` to an `unsigned long long`, keeping the low bits&period;
| xref:absl/uint128/2conversion-0f2.adoc[`operator unsigned short`] 
| Converts this `uint128` to an `unsigned short`, keeping the low bits&period;
| xref:absl/uint128/2conversion-0b.adoc[`operator wchar&lowbar;t`] 
| Converts this `uint128` to a `wchar&lowbar;t`, keeping the low bits&period;
|===


== Friends

[cols="1,4"]
|===
| Name| Description
| `xref:absl/AbslStringify-010.adoc[absl::AbslStringify]`
| Appends the decimal representation of this value to a sink, supporting `absl&colon;&colon;StrCat()` and related functions&period;
| `xref:absl/AbslHashValue-0d06.adoc[absl::AbslHashValue]`
| Combines this value into a hash state, supporting `absl&colon;&colon;Hash`&period;
| `xref:absl/Uint128Max.adoc[absl::Uint128Max]`
| Returns the highest value for a 128&hyphen;bit unsigned integer&period;
| `xref:absl/MakeUint128.adoc[absl::MakeUint128]`
| Constructs a `uint128` numeric value from two 64&hyphen;bit unsigned integers&period;
| `xref:absl/Uint128High64.adoc[absl::Uint128High64]`
| Returns the higher 64&hyphen;bit value of a `uint128` value&period;
| `xref:absl/Uint128Low64.adoc[absl::Uint128Low64]`
| Returns the lower 64&hyphen;bit value of a `uint128` value&period;
|===

== Non-Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:absl/operator_not.adoc[`operator!`]
| Returns the logical negation of `val`&period;
| xref:absl/operator_not_eq-02.adoc[`operator!&equals;`]
| Determines whether `lhs` and `rhs` are unequal&period;
| xref:absl/operator_mod-0c.adoc[`operator%`]
| Returns the remainder of `lhs` divided by `rhs`&period;
| xref:absl/operator_bitand-0b.adoc[`operator&amp;`]
| Returns the bitwise AND of `lhs` and `rhs`&period;
| xref:absl/operator_star-05.adoc[`operator&ast;`]
| Returns the product of `lhs` and `rhs`&period;
| xref:absl/operator_plus-00.adoc[`operator&plus;`]
| Returns the unary plus of `val`, which is `val` unchanged&period;
| xref:absl/operator_plus-07.adoc[`operator&plus;`]
| Returns the sum of `lhs` and `rhs`&period;
| xref:absl/operator_minus-05.adoc[`operator&hyphen;`]
| Returns the difference of `lhs` and `rhs`&period;
| xref:absl/operator_minus-06.adoc[`operator&hyphen;`]
| Returns the arithmetic negation of `val`&period;
| xref:absl/operator_slash-0a.adoc[`operator&sol;`]
| Returns the quotient of `lhs` divided by `rhs`&period;
| xref:absl/operator_lt-0c3.adoc[`operator&lt;`]
| Determines whether `lhs` is less than `rhs`&period;
| xref:absl/operator_lshift-024.adoc[`operator&lt;&lt;`]
| Shifts `lhs` left by the given number of bits&period;
| xref:absl/operator_le-01.adoc[`operator&lt;&equals;`]
| Determines whether `lhs` is less than or equal to `rhs`&period;
| xref:absl/operator_3way-02.adoc[`operator&lt;&equals;&gt;`]
| Performs a three&hyphen;way comparison of `lhs` and `rhs`&period;
| xref:absl/operator_eq-0db.adoc[`operator&equals;&equals;`]
| Determines whether `lhs` and `rhs` are equal&period;
| xref:absl/operator_gt-0b.adoc[`operator&gt;`]
| Determines whether `lhs` is greater than `rhs`&period;
| xref:absl/operator_ge-09.adoc[`operator&gt;&equals;`]
| Determines whether `lhs` is greater than or equal to `rhs`&period;
| xref:absl/operator_rshift-040.adoc[`operator&gt;&gt;`]
| Shifts `lhs` right by the given number of bits&period;
| xref:absl/operator_xor-0e.adoc[`operator&circ;`]
| Returns the bitwise XOR of `lhs` and `rhs`&period;
| xref:absl/operator_bitor-086.adoc[`operator&verbar;`]
| Returns the bitwise OR of `lhs` and `rhs`&period;
| xref:absl/operator_bitnot-00.adoc[`operator&#126;`]
| Returns the bitwise complement of `val`&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
