[#absl-int128] = xref:absl.adoc[absl]::int128 :relfileprefix: ../ :mrdocs: A signed 128‐bit integer type. == Synopsis Declared in `<absl/numeric/int128.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class int128; ---- == Description The API is meant to mimic an intrinsic integral type as closely as is practical, including exhibiting undefined behavior in analogous cases (e.g. division by zero). An `int128` supports the following: * Implicit construction from integral types * Explicit conversion to integral types However, an `int128` differs from intrinsic integral types in the following ways: * It is not implicitly convertible to other integral types. * Requires explicit construction from and conversion to floating point types. Additionally, if your compiler supports `__int128`, `int128` is interoperable with that type. (Abseil checks for this compatibility through the `ABSL_HAVE_INTRINSIC_INT128` macro.) The design goal for `int128` is that it will be compatible with a future `int128_t`, if that type becomes a part of the standard. Example: float y = absl::int128(17); // Error. int128 cannot be implicitly // converted to float. absl::int128 v; int64_t i = v; // Error int64_t i = static_cast<int64_t>(v); // OK == Member Functions [cols="1,4"] |=== | Name| Description | xref:absl/int128/2constructor-040.adoc[`int128`] [.small]#[constructor]# | Constructors | xref:absl/int128/operator_assign-0e.adoc[`operator=`] | Assignment operators | xref:absl/int128/operator_mod_eq.adoc[`operator%=`] | Divides this value by `other` and stores the remainder in place. | xref:absl/int128/operator_and_eq.adoc[`operator&=`] | Applies a bitwise AND with `other` and stores the result in place. | xref:absl/int128/operator_star_eq.adoc[`operator*=`] | Multiplies this value by `other` and stores the result in place. | xref:absl/int128/operator_inc-01.adoc[`operator++`] | Increment operators | xref:absl/int128/operator_plus_eq.adoc[`operator+=`] | Adds `other` to this value and stores the result in place. | xref:absl/int128/operator_dec-04.adoc[`operator‐‐`] | Decrement operators | xref:absl/int128/operator_minus_eq.adoc[`operator‐=`] | Subtracts `other` from this value and stores the result in place. | xref:absl/int128/operator_slash_eq.adoc[`operator/=`] | Divides this value by `other` and stores the quotient in place. | xref:absl/int128/operator_lshift_eq.adoc[`operator<<=`] | Shifts this value left by `amount` bits in place. | xref:absl/int128/operator_rshift_eq.adoc[`operator>>=`] | Shifts this value right by `amount` bits in place. | xref:absl/int128/operator_xor_eq.adoc[`operatorˆ=`] | Applies a bitwise XOR with `other` and stores the result in place. | xref:absl/int128/operator_or_eq.adoc[`operator|=`] | Applies a bitwise OR with `other` and stores the result in place. | xref:absl/int128/2conversion-05d.adoc[`operator __int128`] | Converts this `int128` to a signed `__int128`. | xref:absl/int128/2conversion-0d0.adoc[`operator bool`] | Converts this `int128` to a `bool`. | xref:absl/int128/2conversion-0f7.adoc[`operator char`] | Converts this `int128` to a `char`, keeping the low bits. | xref:absl/int128/2conversion-0f3.adoc[`operator char16_t`] | Converts this `int128` to a `char16_t`, keeping the low bits. | xref:absl/int128/2conversion-0c.adoc[`operator char32_t`] | Converts this `int128` to a `char32_t`, keeping the low bits. | xref:absl/int128/2conversion-0a9.adoc[`operator double`] | Converts this `int128` to a `double`. | xref:absl/int128/2conversion-0fe.adoc[`operator float`] | Converts this `int128` to a `float`. | xref:absl/int128/2conversion-0a0.adoc[`operator int`] | Converts this `int128` to an `int`, keeping the low bits. | xref:absl/int128/2conversion-000f.adoc[`operator long`] | Converts this `int128` to a `long`, keeping the low bits. | xref:absl/int128/2conversion-05b.adoc[`operator long double`] | Converts this `int128` to a `long double`. | xref:absl/int128/2conversion-06.adoc[`operator long long`] | Converts this `int128` to a `long long`, keeping the low bits. | xref:absl/int128/2conversion-03.adoc[`operator short`] | Converts this `int128` to a `short`, keeping the low bits. | xref:absl/int128/2conversion-0a7.adoc[`operator signed char`] | Converts this `int128` to a `signed char`, keeping the low bits. | xref:absl/int128/2conversion-0003.adoc[`operator unsigned __int128`] | Converts this `int128` to an `unsigned __int128`. | xref:absl/int128/2conversion-01.adoc[`operator unsigned char`] | Converts this `int128` to an `unsigned char`, keeping the low bits. | xref:absl/int128/2conversion-04.adoc[`operator unsigned int`] | Converts this `int128` to an `unsigned int`, keeping the low bits. | xref:absl/int128/2conversion-0e.adoc[`operator unsigned long`] | Converts this `int128` to an `unsigned long`, keeping the low bits. | xref:absl/int128/2conversion-05c.adoc[`operator unsigned long long`] | Converts this `int128` to an `unsigned long long`, keeping the low bits. | xref:absl/int128/2conversion-0d8.adoc[`operator unsigned short`] | Converts this `int128` to an `unsigned short`, keeping the low bits. | xref:absl/int128/2conversion-08.adoc[`operator wchar_t`] | Converts this `int128` to a `wchar_t`, keeping the low bits. |=== == Friends [cols="1,4"] |=== | Name| Description | `xref:absl/AbslStringify-061.adoc[absl::AbslStringify]` | Appends the decimal representation of this value to a sink, supporting `absl::StrCat()` and related functions. | `xref:absl/AbslHashValue-0d0d.adoc[absl::AbslHashValue]` | Combines this value into a hash state, supporting `absl::Hash`. | `xref:absl/Int128Min.adoc[absl::Int128Min]` | Returns the minimum value for a 128‐bit signed integer. | `xref:absl/Int128Max.adoc[absl::Int128Max]` | Returns the maximum value for a 128‐bit signed integer. | `xref:absl/MakeInt128.adoc[absl::MakeInt128]` | Constructs an `int128` numeric value from two 64‐bit integers. | `xref:absl/Int128High64.adoc[absl::Int128High64]` | Returns the higher 64‐bit value of an `int128` value. | `xref:absl/Int128Low64.adoc[absl::Int128Low64]` | Returns the lower 64‐bit value of an `int128` value. |=== == Non-Member Functions [cols="1,4"] |=== | Name| Description | xref:absl/operator_not_eq-00b.adoc[`operator!=`] | Determines whether `lhs` and `rhs` are unequal. | xref:absl/operator_mod-00.adoc[`operator%`] | Returns the remainder of `lhs` divided by `rhs`. | xref:absl/operator_bitand-07.adoc[`operator&`] | Returns the bitwise AND of `lhs` and `rhs`. | xref:absl/operator_star-0b69.adoc[`operator*`] | Returns the product of `lhs` and `rhs`. | xref:absl/operator_plus-08.adoc[`operator+`] | Returns the sum of `lhs` and `rhs`. | xref:absl/operator_plus-0f.adoc[`operator+`] | Returns the unary plus of `val`, which is `val` unchanged. | xref:absl/operator_minus-0a.adoc[`operator‐`] | Returns the difference of `lhs` and `rhs`. | xref:absl/operator_minus-0ee.adoc[`operator‐`] | Returns the arithmetic negation of `v`. | xref:absl/operator_slash-0d.adoc[`operator/`] | Returns the quotient of `lhs` divided by `rhs`. | xref:absl/operator_lshift-06e.adoc[`operator<<`] | Shifts `lhs` left by the given number of bits. | xref:absl/operator_rshift-02d.adoc[`operator>>`] | Shifts `lhs` right by the given number of bits. | xref:absl/operator_xor-0883.adoc[`operatorˆ`] | Returns the bitwise XOR of `lhs` and `rhs`. | xref:absl/operator_bitor-04.adoc[`operator|`] | Returns the bitwise OR of `lhs` and `rhs`. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#