Skip to content

<xstd/ints/cstdint/int128.hpp>

XSTD_HAS_INT128

#define XSTD_HAS_INT128 see below

Whether the 128-bit pair is available. Defined as 1 where _MSC_VER is defined or, failing that, where __SIZEOF_INT128__ is; not defined otherwise.

Notes

Where it is not defined, as with GCC and Clang on 32-bit x86 and ARM, int128, uint128 and their two associations are not declared, and including the header is not an error.

See also

Entity Relation
int128, uint128 declared where it is defined
XSTD_HAS_BIT_INT the same question asked of the bit-precise types

xstd::int128, xstd::uint128

// (1)
using int128 = see below;

// (2)
using uint128 = see below;

// (3)
template<> struct make_unsigned<int128>;

// (4)
template<> struct make_signed<uint128>;

The 128-bit integer pair: where _MSC_VER is defined, std::_Signed128 and std::_Unsigned128 from the Microsoft STL's <__msvc_int128.hpp>; otherwise __int128 and unsigned __int128.

  1. The signed half.
  2. The unsigned half.
  3. make_unsigned<int128>::type is uint128.
  4. make_signed<uint128>::type is int128.

Remarks

  • The aliases and the two associations are declared in one header, so a translation unit that names either type has both specializations.
  • GCC's -Wpedantic diagnostic on __int128 is suppressed around the two alias declarations.

Notes

  • Each occupies 16 bytes, and std::numeric_limits gives int128 127 digits and uint128 128.
  • int128 is signed and uint128 unsigned, by std::numeric_limits, by is_signed_v and is_unsigned_v under every cv-qualification, and by signed_integer and unsigned_integer.
  • The width carries values: int128{-1} < int128{0}, and uint128{1} << 127U is nonzero, as constant expressions.
  • Through the cv-qualified specializations of either trait, const, volatile and const volatile carry over.
  • Both model nothrow_const_operators.

See also

Entity Relation
make_signed, make_unsigned the traits (3) and (4) specialize
signed_integer, unsigned_integer what (1) and (2) model
boost::int128, absl::int128 the other 128-bit pairs, paired by the ext headers
bit_int, bit_uint the bit-precise types