absl::MakeInt128

Constructs an int128 numeric value from two 64-bit integers.

Synopsis

Declared in <absl/numeric/int128.h>

constexpr
int128
MakeInt128(
    int64_t high,
    uint64_t low);

Description

Signedness is conveyed in the upper high value, following (absl::int128(1) << 64) * high + low. This factory function is the only way to construct an int128 from integer values greater than 2^64 or less than -2^64.

Example:

absl::int128 big = absl::MakeInt128(1, 0); absl::int128 big_n = absl::MakeInt128(-1, 0);

Return Value

An int128 assembled from high and low.

Parameters

NameDescription
highThe high-order 64 bits, carrying the sign, of the result.
lowThe low-order 64 bits of the result.