Commit 0d40cb77 by Abseil Team Committed by Derek Mauro

Changes imported from Abseil "staging" branch:

  - 5d9197f54029dd26e144365738e99a1d3582cc18 Change alignment requirement for uint128. by Alex Strelnikov <strel@google.com>

GitOrigin-RevId: 5d9197f54029dd26e144365738e99a1d3582cc18
Change-Id: Ibac0689c5d95a019441be9d4479b65c5aba1c286
parent dca2eb50
......@@ -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<uint64_t>(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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment