From 0d40cb771eec8741f44e5979cfccf1eeeedb012a Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Thu, 22 Feb 2018 08:36:39 -0800 Subject: Changes imported from Abseil "staging" branch: - 5d9197f54029dd26e144365738e99a1d3582cc18 Change alignment requirement for uint128. by Alex Strelnikov GitOrigin-RevId: 5d9197f54029dd26e144365738e99a1d3582cc18 Change-Id: Ibac0689c5d95a019441be9d4479b65c5aba1c286 --- absl/numeric/int128.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'absl/numeric') diff --git a/absl/numeric/int128.h b/absl/numeric/int128.h index 2eded2f..803f0ff 100644 --- a/absl/numeric/int128.h +++ b/absl/numeric/int128.h @@ -45,8 +45,8 @@ namespace absl { // as closely as is practical, including exhibiting undefined behavior in // analogous cases (e.g. division by zero). This type is intended to be a // drop-in replacement once C++ supports an intrinsic `uint128_t` type; when -// that occurs, existing uses of `uint128` will continue to work using that new -// type. +// that occurs, existing well-behaved uses of `uint128` will continue to work +// using that new type. // // Note: code written with this type will continue to compile once `uint128_t` // is introduced, provided the replacement helper functions @@ -70,6 +70,9 @@ namespace absl { // types. // * Conversion to integral types requires an explicit static_cast() to // mimic use of the `-Wnarrowing` compiler flag. +// * The alignment requirement of `uint128` may differ from that of an +// intrinsic 128-bit integer type depending on platform and build +// configuration. // // Example: // @@ -80,7 +83,11 @@ namespace absl { // absl::uint64_t i = v; // Error // absl::uint64_t i = static_cast(v); // OK // -class alignas(16) uint128 { +class +#if defined(ABSL_HAVE_INTRINSIC_INT128) + alignas(unsigned __int128) +#endif // ABSL_HAVE_INTRINSIC_INT128 + uint128 { public: uint128() = default; -- cgit v1.2.3