aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore/third_party/abseil-cpp/absl/numeric
diff options
context:
space:
mode:
Diffstat (limited to 'Firestore/third_party/abseil-cpp/absl/numeric')
-rw-r--r--Firestore/third_party/abseil-cpp/absl/numeric/int128.cc73
-rw-r--r--Firestore/third_party/abseil-cpp/absl/numeric/int128.h262
-rw-r--r--Firestore/third_party/abseil-cpp/absl/numeric/int128_have_intrinsic.inc19
-rw-r--r--Firestore/third_party/abseil-cpp/absl/numeric/int128_no_intrinsic.inc19
-rw-r--r--Firestore/third_party/abseil-cpp/absl/numeric/int128_test.cc6
5 files changed, 227 insertions, 152 deletions
diff --git a/Firestore/third_party/abseil-cpp/absl/numeric/int128.cc b/Firestore/third_party/abseil-cpp/absl/numeric/int128.cc
index 00bf7f4..3688e5e 100644
--- a/Firestore/third_party/abseil-cpp/absl/numeric/int128.cc
+++ b/Firestore/third_party/abseil-cpp/absl/numeric/int128.cc
@@ -20,6 +20,7 @@
#include <iostream> // NOLINT(readability/streams)
#include <sstream>
#include <string>
+#include <type_traits>
namespace absl {
@@ -104,11 +105,15 @@ void DivModImpl(uint128 dividend, uint128 divisor, uint128* quotient_ret,
}
template <typename T>
-uint128 Initialize128FromFloat(T v) {
+uint128 MakeUint128FromFloat(T v) {
+ static_assert(std::is_floating_point<T>::value, "");
+
// Rounding behavior is towards zero, same as for built-in types.
// Undefined behavior if v is NaN or cannot fit into uint128.
- assert(!std::isnan(v) && v > -1 && v < std::ldexp(static_cast<T>(1), 128));
+ assert(std::isfinite(v) && v > -1 &&
+ (std::numeric_limits<T>::max_exponent <= 128 ||
+ v < std::ldexp(static_cast<T>(1), 128)));
if (v >= std::ldexp(static_cast<T>(1), 64)) {
uint64_t hi = static_cast<uint64_t>(std::ldexp(v, -64));
@@ -120,28 +125,36 @@ uint128 Initialize128FromFloat(T v) {
}
} // namespace
-uint128::uint128(float v) : uint128(Initialize128FromFloat(v)) {}
-uint128::uint128(double v) : uint128(Initialize128FromFloat(v)) {}
-uint128::uint128(long double v) : uint128(Initialize128FromFloat(v)) {}
+uint128::uint128(float v) : uint128(MakeUint128FromFloat(v)) {}
+uint128::uint128(double v) : uint128(MakeUint128FromFloat(v)) {}
+uint128::uint128(long double v) : uint128(MakeUint128FromFloat(v)) {}
-uint128& uint128::operator/=(uint128 other) {
+uint128 operator/(uint128 lhs, uint128 rhs) {
+#if defined(ABSL_HAVE_INTRINSIC_INT128)
+ return static_cast<unsigned __int128>(lhs) /
+ static_cast<unsigned __int128>(rhs);
+#else // ABSL_HAVE_INTRINSIC_INT128
uint128 quotient = 0;
uint128 remainder = 0;
- DivModImpl(*this, other, &quotient, &remainder);
- *this = quotient;
- return *this;
+ DivModImpl(lhs, rhs, &quotient, &remainder);
+ return quotient;
+#endif // ABSL_HAVE_INTRINSIC_INT128
}
-uint128& uint128::operator%=(uint128 other) {
+uint128 operator%(uint128 lhs, uint128 rhs) {
+#if defined(ABSL_HAVE_INTRINSIC_INT128)
+ return static_cast<unsigned __int128>(lhs) %
+ static_cast<unsigned __int128>(rhs);
+#else // ABSL_HAVE_INTRINSIC_INT128
uint128 quotient = 0;
uint128 remainder = 0;
- DivModImpl(*this, other, &quotient, &remainder);
- *this = remainder;
- return *this;
+ DivModImpl(lhs, rhs, &quotient, &remainder);
+ return remainder;
+#endif // ABSL_HAVE_INTRINSIC_INT128
}
-std::ostream& operator<<(std::ostream& o, uint128 b) {
- std::ios_base::fmtflags flags = o.flags();
+namespace {
+std::string Uint128ToFormattedString(uint128 v, std::ios_base::fmtflags flags) {
// Select a divisor which is the largest power of the base < 2^64.
uint128 div;
int div_base_log;
@@ -160,14 +173,14 @@ std::ostream& operator<<(std::ostream& o, uint128 b) {
break;
}
- // Now piece together the uint128 representation from three chunks of
- // the original value, each less than "div" and therefore representable
- // as a uint64_t.
+ // Now piece together the uint128 representation from three chunks of the
+ // original value, each less than "div" and therefore representable as a
+ // uint64_t.
std::ostringstream os;
std::ios_base::fmtflags copy_mask =
std::ios::basefield | std::ios::showbase | std::ios::uppercase;
os.setf(flags & copy_mask, copy_mask);
- uint128 high = b;
+ uint128 high = v;
uint128 low;
DivModImpl(high, div, &high, &low);
uint128 mid;
@@ -182,25 +195,31 @@ std::ostream& operator<<(std::ostream& o, uint128 b) {
os << std::noshowbase << std::setfill('0') << std::setw(div_base_log);
}
os << Uint128Low64(low);
- std::string rep = os.str();
+ return os.str();
+}
+
+} // namespace
+
+std::ostream& operator<<(std::ostream& os, uint128 v) {
+ std::ios_base::fmtflags flags = os.flags();
+ std::string rep = Uint128ToFormattedString(v, flags);
// Add the requisite padding.
- std::streamsize width = o.width(0);
+ std::streamsize width = os.width(0);
if (static_cast<size_t>(width) > rep.size()) {
std::ios::fmtflags adjustfield = flags & std::ios::adjustfield;
if (adjustfield == std::ios::left) {
- rep.append(width - rep.size(), o.fill());
+ rep.append(width - rep.size(), os.fill());
} else if (adjustfield == std::ios::internal &&
(flags & std::ios::showbase) &&
- (flags & std::ios::basefield) == std::ios::hex && b != 0) {
- rep.insert(2, width - rep.size(), o.fill());
+ (flags & std::ios::basefield) == std::ios::hex && v != 0) {
+ rep.insert(2, width - rep.size(), os.fill());
} else {
- rep.insert(0, width - rep.size(), o.fill());
+ rep.insert(0, width - rep.size(), os.fill());
}
}
- // Stream the final representation in a single "<<" call.
- return o << rep;
+ return os << rep;
}
} // namespace absl
diff --git a/Firestore/third_party/abseil-cpp/absl/numeric/int128.h b/Firestore/third_party/abseil-cpp/absl/numeric/int128.h
index d87cbbd..bc7dbb4 100644
--- a/Firestore/third_party/abseil-cpp/absl/numeric/int128.h
+++ b/Firestore/third_party/abseil-cpp/absl/numeric/int128.h
@@ -17,9 +17,10 @@
// File: int128.h
// -----------------------------------------------------------------------------
//
-// This header file defines 128-bit integer types. Currently, this file defines
-// `uint128`, an unsigned 128-bit integer; a signed 128-bit integer is
-// forthcoming.
+// This header file defines 128-bit integer types.
+//
+// Currently, this file defines `uint128`, an unsigned 128-bit integer; a signed
+// 128-bit integer is forthcoming.
#ifndef ABSL_NUMERIC_INT128_H_
#define ABSL_NUMERIC_INT128_H_
@@ -37,14 +38,15 @@
namespace absl {
+
// uint128
//
// An unsigned 128-bit integer type. The API is meant to mimic an intrinsic type
// 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
@@ -62,23 +64,30 @@ namespace absl {
// However, a `uint128` differs from intrinsic integral types in the following
// ways:
//
-// * Errors on implicit conversions that does not preserve value (such as
+// * Errors on implicit conversions that do not preserve value (such as
// loss of precision when converting to float values).
// * Requires explicit construction from and conversion to floating point
// 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:
//
-// float y = absl::kuint128max; // Error. uint128 cannot be implicitly
-// // converted to float.
+// float y = absl::Uint128Max(); // Error. uint128 cannot be implicitly
+// // converted to float.
//
// absl::uint128 v;
-// absl::uint64_t i = v; // Error
-// absl::uint64_t i = static_cast<uint64_t>(v); // OK
+// uint64_t i = v; // Error
+// 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;
@@ -175,10 +184,15 @@ class alignas(16) uint128 {
// Example:
//
// absl::uint128 big = absl::MakeUint128(1, 0);
- friend constexpr uint128 MakeUint128(uint64_t top, uint64_t bottom);
+ friend constexpr uint128 MakeUint128(uint64_t high, uint64_t low);
+
+ // Uint128Max()
+ //
+ // Returns the highest value for a 128-bit unsigned integer.
+ friend constexpr uint128 Uint128Max();
private:
- constexpr uint128(uint64_t top, uint64_t bottom);
+ constexpr uint128(uint64_t high, uint64_t low);
// TODO(strel) Update implementation to use __int128 once all users of
// uint128 are fixed to not depend on alignof(uint128) == 8. Also add
@@ -195,10 +209,13 @@ class alignas(16) uint128 {
#endif // byte order
};
+// Prefer to use the constexpr `Uint128Max()`.
+//
+// TODO(absl-team) deprecate kuint128max once migration tool is released.
extern const uint128 kuint128max;
// allow uint128 to be logged
-extern std::ostream& operator<<(std::ostream& o, uint128 b);
+std::ostream& operator<<(std::ostream& os, uint128 v);
// TODO(strel) add operator>>(std::istream&, uint128)
@@ -208,8 +225,13 @@ extern std::ostream& operator<<(std::ostream& o, uint128 b);
// Implementation details follow
// --------------------------------------------------------------------------
-constexpr uint128 MakeUint128(uint64_t top, uint64_t bottom) {
- return uint128(top, bottom);
+constexpr uint128 MakeUint128(uint64_t high, uint64_t low) {
+ return uint128(high, low);
+}
+
+constexpr uint128 Uint128Max() {
+ return uint128(std::numeric_limits<uint64_t>::max(),
+ std::numeric_limits<uint64_t>::max());
}
// Assignment from integer types.
@@ -249,34 +271,49 @@ inline uint128& uint128::operator=(unsigned __int128 v) {
}
#endif // ABSL_HAVE_INTRINSIC_INT128
-// Shift and arithmetic operators.
+// Arithmetic operators.
-inline uint128 operator<<(uint128 lhs, int amount) {
- return uint128(lhs) <<= amount;
+uint128 operator<<(uint128 lhs, int amount);
+uint128 operator>>(uint128 lhs, int amount);
+uint128 operator+(uint128 lhs, uint128 rhs);
+uint128 operator-(uint128 lhs, uint128 rhs);
+uint128 operator*(uint128 lhs, uint128 rhs);
+uint128 operator/(uint128 lhs, uint128 rhs);
+uint128 operator%(uint128 lhs, uint128 rhs);
+
+inline uint128& uint128::operator<<=(int amount) {
+ *this = *this << amount;
+ return *this;
}
-inline uint128 operator>>(uint128 lhs, int amount) {
- return uint128(lhs) >>= amount;
+inline uint128& uint128::operator>>=(int amount) {
+ *this = *this >> amount;
+ return *this;
}
-inline uint128 operator+(uint128 lhs, uint128 rhs) {
- return uint128(lhs) += rhs;
+inline uint128& uint128::operator+=(uint128 other) {
+ *this = *this + other;
+ return *this;
}
-inline uint128 operator-(uint128 lhs, uint128 rhs) {
- return uint128(lhs) -= rhs;
+inline uint128& uint128::operator-=(uint128 other) {
+ *this = *this - other;
+ return *this;
}
-inline uint128 operator*(uint128 lhs, uint128 rhs) {
- return uint128(lhs) *= rhs;
+inline uint128& uint128::operator*=(uint128 other) {
+ *this = *this * other;
+ return *this;
}
-inline uint128 operator/(uint128 lhs, uint128 rhs) {
- return uint128(lhs) /= rhs;
+inline uint128& uint128::operator/=(uint128 other) {
+ *this = *this / other;
+ return *this;
}
-inline uint128 operator%(uint128 lhs, uint128 rhs) {
- return uint128(lhs) %= rhs;
+inline uint128& uint128::operator%=(uint128 other) {
+ *this = *this % other;
+ return *this;
}
constexpr uint64_t Uint128Low64(uint128 v) { return v.lo_; }
@@ -287,56 +324,62 @@ constexpr uint64_t Uint128High64(uint128 v) { return v.hi_; }
#if defined(ABSL_IS_LITTLE_ENDIAN)
-constexpr uint128::uint128(uint64_t top, uint64_t bottom)
- : lo_(bottom), hi_(top) {}
+constexpr uint128::uint128(uint64_t high, uint64_t low)
+ : lo_{low}, hi_{high} {}
constexpr uint128::uint128(int v)
- : lo_(v), hi_(v < 0 ? std::numeric_limits<uint64_t>::max() : 0) {}
+ : lo_{static_cast<uint64_t>(v)},
+ hi_{v < 0 ? std::numeric_limits<uint64_t>::max() : 0} {}
constexpr uint128::uint128(long v) // NOLINT(runtime/int)
- : lo_(v), hi_(v < 0 ? std::numeric_limits<uint64_t>::max() : 0) {}
+ : lo_{static_cast<uint64_t>(v)},
+ hi_{v < 0 ? std::numeric_limits<uint64_t>::max() : 0} {}
constexpr uint128::uint128(long long v) // NOLINT(runtime/int)
- : lo_(v), hi_(v < 0 ? std::numeric_limits<uint64_t>::max() : 0) {}
+ : lo_{static_cast<uint64_t>(v)},
+ hi_{v < 0 ? std::numeric_limits<uint64_t>::max() : 0} {}
-constexpr uint128::uint128(unsigned int v) : lo_(v), hi_(0) {}
+constexpr uint128::uint128(unsigned int v) : lo_{v}, hi_{0} {}
// NOLINTNEXTLINE(runtime/int)
-constexpr uint128::uint128(unsigned long v) : lo_(v), hi_(0) {}
+constexpr uint128::uint128(unsigned long v) : lo_{v}, hi_{0} {}
// NOLINTNEXTLINE(runtime/int)
-constexpr uint128::uint128(unsigned long long v) : lo_(v), hi_(0) {}
+constexpr uint128::uint128(unsigned long long v) : lo_{v}, hi_{0} {}
#ifdef ABSL_HAVE_INTRINSIC_INT128
constexpr uint128::uint128(__int128 v)
- : lo_(static_cast<uint64_t>(v & ~uint64_t{0})),
- hi_(static_cast<uint64_t>(static_cast<unsigned __int128>(v) >> 64)) {}
+ : lo_{static_cast<uint64_t>(v & ~uint64_t{0})},
+ hi_{static_cast<uint64_t>(static_cast<unsigned __int128>(v) >> 64)} {}
constexpr uint128::uint128(unsigned __int128 v)
- : lo_(static_cast<uint64_t>(v & ~uint64_t{0})),
- hi_(static_cast<uint64_t>(v >> 64)) {}
+ : lo_{static_cast<uint64_t>(v & ~uint64_t{0})},
+ hi_{static_cast<uint64_t>(v >> 64)} {}
#endif // ABSL_HAVE_INTRINSIC_INT128
#elif defined(ABSL_IS_BIG_ENDIAN)
-constexpr uint128::uint128(uint64_t top, uint64_t bottom)
- : hi_(top), lo_(bottom) {}
+constexpr uint128::uint128(uint64_t high, uint64_t low)
+ : hi_{high}, lo_{low} {}
constexpr uint128::uint128(int v)
- : hi_(v < 0 ? std::numeric_limits<uint64_t>::max() : 0), lo_(v) {}
+ : hi_{v < 0 ? std::numeric_limits<uint64_t>::max() : 0},
+ lo_{static_cast<uint64_t>(v)} {}
constexpr uint128::uint128(long v) // NOLINT(runtime/int)
- : hi_(v < 0 ? std::numeric_limits<uint64_t>::max() : 0), lo_(v) {}
+ : hi_{v < 0 ? std::numeric_limits<uint64_t>::max() : 0},
+ lo_{static_cast<uint64_t>(v)} {}
constexpr uint128::uint128(long long v) // NOLINT(runtime/int)
- : hi_(v < 0 ? std::numeric_limits<uint64_t>::max() : 0), lo_(v) {}
+ : hi_{v < 0 ? std::numeric_limits<uint64_t>::max() : 0},
+ lo_{static_cast<uint64_t>(v)} {}
-constexpr uint128::uint128(unsigned int v) : hi_(0), lo_(v) {}
+constexpr uint128::uint128(unsigned int v) : hi_{0}, lo_{v} {}
// NOLINTNEXTLINE(runtime/int)
-constexpr uint128::uint128(unsigned long v) : hi_(0), lo_(v) {}
+constexpr uint128::uint128(unsigned long v) : hi_{0}, lo_{v} {}
// NOLINTNEXTLINE(runtime/int)
-constexpr uint128::uint128(unsigned long long v) : hi_(0), lo_(v) {}
+constexpr uint128::uint128(unsigned long long v) : hi_{0}, lo_{v} {}
#ifdef ABSL_HAVE_INTRINSIC_INT128
constexpr uint128::uint128(__int128 v)
- : hi_(static_cast<uint64_t>(static_cast<unsigned __int128>(v) >> 64)),
- lo_(static_cast<uint64_t>(v & ~uint64_t{0})) {}
+ : hi_{static_cast<uint64_t>(static_cast<unsigned __int128>(v) >> 64)},
+ lo_{static_cast<uint64_t>(v & ~uint64_t{0})} {}
constexpr uint128::uint128(unsigned __int128 v)
- : hi_(static_cast<uint64_t>(v >> 64)),
- lo_(static_cast<uint64_t>(v & ~uint64_t{0})) {}
+ : hi_{static_cast<uint64_t>(v >> 64)},
+ lo_{static_cast<uint64_t>(v & ~uint64_t{0})} {}
#endif // ABSL_HAVE_INTRINSIC_INT128
#else // byte order
@@ -460,13 +503,10 @@ inline bool operator>=(uint128 lhs, uint128 rhs) {
// Unary operators.
inline uint128 operator-(uint128 val) {
- const uint64_t hi_flip = ~Uint128High64(val);
- const uint64_t lo_flip = ~Uint128Low64(val);
- const uint64_t lo_add = lo_flip + 1;
- if (lo_add < lo_flip) {
- return MakeUint128(hi_flip + 1, lo_add);
- }
- return MakeUint128(hi_flip, lo_add);
+ uint64_t hi = ~Uint128High64(val);
+ uint64_t lo = ~Uint128Low64(val) + 1;
+ if (lo == 0) ++hi; // carry
+ return MakeUint128(hi, lo);
}
inline bool operator!(uint128 val) {
@@ -512,88 +552,72 @@ inline uint128& uint128::operator^=(uint128 other) {
return *this;
}
-// Shift and arithmetic assign operators.
-
-inline uint128& uint128::operator<<=(int amount) {
- // Shifts of >= 128 are undefined.
- assert(amount < 128);
+// Arithmetic operators.
+inline uint128 operator<<(uint128 lhs, int amount) {
// uint64_t shifts of >= 64 are undefined, so we will need some
// special-casing.
if (amount < 64) {
if (amount != 0) {
- hi_ = (hi_ << amount) | (lo_ >> (64 - amount));
- lo_ = lo_ << amount;
+ return MakeUint128(
+ (Uint128High64(lhs) << amount) | (Uint128Low64(lhs) >> (64 - amount)),
+ Uint128Low64(lhs) << amount);
}
- } else {
- hi_ = lo_ << (amount - 64);
- lo_ = 0;
+ return lhs;
}
- return *this;
+ return MakeUint128(Uint128Low64(lhs) << (amount - 64), 0);
}
-inline uint128& uint128::operator>>=(int amount) {
- // Shifts of >= 128 are undefined.
- assert(amount < 128);
-
+inline uint128 operator>>(uint128 lhs, int amount) {
// uint64_t shifts of >= 64 are undefined, so we will need some
// special-casing.
if (amount < 64) {
if (amount != 0) {
- lo_ = (lo_ >> amount) | (hi_ << (64 - amount));
- hi_ = hi_ >> amount;
+ return MakeUint128(Uint128High64(lhs) >> amount,
+ (Uint128Low64(lhs) >> amount) |
+ (Uint128High64(lhs) << (64 - amount)));
}
- } else {
- lo_ = hi_ >> (amount - 64);
- hi_ = 0;
+ return lhs;
}
- return *this;
+ return MakeUint128(0, Uint128High64(lhs) >> (amount - 64));
}
-inline uint128& uint128::operator+=(uint128 other) {
- hi_ += other.hi_;
- uint64_t lolo = lo_ + other.lo_;
- if (lolo < lo_)
- ++hi_;
- lo_ = lolo;
- return *this;
+inline uint128 operator+(uint128 lhs, uint128 rhs) {
+ uint128 result = MakeUint128(Uint128High64(lhs) + Uint128High64(rhs),
+ Uint128Low64(lhs) + Uint128Low64(rhs));
+ if (Uint128Low64(result) < Uint128Low64(lhs)) { // check for carry
+ return MakeUint128(Uint128High64(result) + 1, Uint128Low64(result));
+ }
+ return result;
}
-inline uint128& uint128::operator-=(uint128 other) {
- hi_ -= other.hi_;
- if (other.lo_ > lo_) --hi_;
- lo_ -= other.lo_;
- return *this;
+inline uint128 operator-(uint128 lhs, uint128 rhs) {
+ uint128 result = MakeUint128(Uint128High64(lhs) - Uint128High64(rhs),
+ Uint128Low64(lhs) - Uint128Low64(rhs));
+ if (Uint128Low64(lhs) < Uint128Low64(rhs)) { // check for carry
+ return MakeUint128(Uint128High64(result) - 1, Uint128Low64(result));
+ }
+ return result;
}
-inline uint128& uint128::operator*=(uint128 other) {
+inline uint128 operator*(uint128 lhs, uint128 rhs) {
#if defined(ABSL_HAVE_INTRINSIC_INT128)
// TODO(strel) Remove once alignment issues are resolved and unsigned __int128
// can be used for uint128 storage.
- *this = static_cast<unsigned __int128>(*this) *
- static_cast<unsigned __int128>(other);
- return *this;
+ return static_cast<unsigned __int128>(lhs) *
+ static_cast<unsigned __int128>(rhs);
#else // ABSL_HAVE_INTRINSIC128
- uint64_t a96 = hi_ >> 32;
- uint64_t a64 = hi_ & 0xffffffff;
- uint64_t a32 = lo_ >> 32;
- uint64_t a00 = lo_ & 0xffffffff;
- uint64_t b96 = other.hi_ >> 32;
- uint64_t b64 = other.hi_ & 0xffffffff;
- uint64_t b32 = other.lo_ >> 32;
- uint64_t b00 = other.lo_ & 0xffffffff;
- // multiply [a96 .. a00] x [b96 .. b00]
- // terms higher than c96 disappear off the high side
- // terms c96 and c64 are safe to ignore carry bit
- uint64_t c96 = a96 * b00 + a64 * b32 + a32 * b64 + a00 * b96;
- uint64_t c64 = a64 * b00 + a32 * b32 + a00 * b64;
- this->hi_ = (c96 << 32) + c64;
- this->lo_ = 0;
- // add terms after this one at a time to capture carry
- *this += uint128(a32 * b00) << 32;
- *this += uint128(a00 * b32) << 32;
- *this += a00 * b00;
- return *this;
+ uint64_t a32 = Uint128Low64(lhs) >> 32;
+ uint64_t a00 = Uint128Low64(lhs) & 0xffffffff;
+ uint64_t b32 = Uint128Low64(rhs) >> 32;
+ uint64_t b00 = Uint128Low64(rhs) & 0xffffffff;
+ uint128 result =
+ MakeUint128(Uint128High64(lhs) * Uint128Low64(rhs) +
+ Uint128Low64(lhs) * Uint128High64(rhs) + a32 * b32,
+ a00 * b00);
+ result += uint128(a32 * b00) << 32;
+ result += uint128(a00 * b32) << 32;
+ return result;
#endif // ABSL_HAVE_INTRINSIC128
}
diff --git a/Firestore/third_party/abseil-cpp/absl/numeric/int128_have_intrinsic.inc b/Firestore/third_party/abseil-cpp/absl/numeric/int128_have_intrinsic.inc
index 49bde07..ee2a093 100644
--- a/Firestore/third_party/abseil-cpp/absl/numeric/int128_have_intrinsic.inc
+++ b/Firestore/third_party/abseil-cpp/absl/numeric/int128_have_intrinsic.inc
@@ -1,3 +1,18 @@
-// This file will contain :int128 implementation details that depend on internal
-// representation when ABSL_HAVE_INTRINSIC_INT128 is defined. This file will be
+//
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// This file contains :int128 implementation details that depend on internal
+// representation when ABSL_HAVE_INTRINSIC_INT128 is defined. This file is
// included by int128.h.
diff --git a/Firestore/third_party/abseil-cpp/absl/numeric/int128_no_intrinsic.inc b/Firestore/third_party/abseil-cpp/absl/numeric/int128_no_intrinsic.inc
index 2dbff2b..0d0b3cf 100644
--- a/Firestore/third_party/abseil-cpp/absl/numeric/int128_no_intrinsic.inc
+++ b/Firestore/third_party/abseil-cpp/absl/numeric/int128_no_intrinsic.inc
@@ -1,3 +1,18 @@
-// This file will contain :int128 implementation details that depend on internal
+//
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// This file contains :int128 implementation details that depend on internal
// representation when ABSL_HAVE_INTRINSIC_INT128 is *not* defined. This file
-// will be included by int128.h.
+// is included by int128.h.
diff --git a/Firestore/third_party/abseil-cpp/absl/numeric/int128_test.cc b/Firestore/third_party/abseil-cpp/absl/numeric/int128_test.cc
index b9d3647..74d362d 100644
--- a/Firestore/third_party/abseil-cpp/absl/numeric/int128_test.cc
+++ b/Firestore/third_party/abseil-cpp/absl/numeric/int128_test.cc
@@ -109,7 +109,7 @@ TEST(Uint128, AllTests) {
absl::uint128 big = absl::MakeUint128(2000, 2);
absl::uint128 big_minus_one = absl::MakeUint128(2000, 1);
absl::uint128 bigger = absl::MakeUint128(2001, 1);
- absl::uint128 biggest = absl::kuint128max;
+ absl::uint128 biggest = absl::Uint128Max();
absl::uint128 high_low = absl::MakeUint128(1, 0);
absl::uint128 low_high =
absl::MakeUint128(0, std::numeric_limits<uint64_t>::max());
@@ -226,8 +226,10 @@ TEST(Uint128, AllTests) {
EXPECT_EQ(big, -(-big));
EXPECT_EQ(two, -((-one) - 1));
- EXPECT_EQ(absl::kuint128max, -one);
+ EXPECT_EQ(absl::Uint128Max(), -one);
EXPECT_EQ(zero, -zero);
+
+ EXPECT_EQ(absl::Uint128Max(), absl::kuint128max);
}
TEST(Uint128, ConversionTests) {