diff options
author | Abseil Team <absl-team@google.com> | 2018-02-06T14·42-0800 |
---|---|---|
committer | katzdm <katzdm@google.com> | 2018-02-06T20·03-0500 |
commit | 3917120a4c6ba8c401714c1655b4a6d7ace3d049 (patch) | |
tree | 19793d9bcfa24105d7569b6af17b6d76f26d088a /absl/numeric/int128.cc | |
parent | bf7fc9986e20f664958fc227547fd8d2fdcf863e (diff) |
Changes imported from Abseil "staging" branch:
- b7ac57541b07fadc3ed054cc3d62bc192a2098a7 Redefine arithmetic assign operators in terms of the bina... by Alex Strelnikov <strel@google.com> - bb2bf3fd86eb9f24420376aad1b9fe84068ad7e4 Cmake CI for Ubuntu by Jon Cohen <cohenjon@google.com> - 3ff3e6d6b4d99627f0785cad5b562362bdf1ae37 Fix internal namespace (debug_internal -> debugging_inter... by Derek Mauro <dmauro@google.com> - b50753d757c95a3430cc2d6cfc0272af1e5c219c Internal change. by Alex Strelnikov <strel@google.com> GitOrigin-RevId: b7ac57541b07fadc3ed054cc3d62bc192a2098a7 Change-Id: I7561639e296d1cc5dc7ee75e6645e8dae3f1bf97
Diffstat (limited to 'absl/numeric/int128.cc')
-rw-r--r-- | absl/numeric/int128.cc | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/absl/numeric/int128.cc b/absl/numeric/int128.cc index b32d8095fdf1..f24b785c04c0 100644 --- a/absl/numeric/int128.cc +++ b/absl/numeric/int128.cc @@ -20,6 +20,7 @@ #include <iostream> // NOLINT(readability/streams) #include <sstream> #include <string> +#include <type_traits> namespace absl { @@ -128,19 +129,17 @@ 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) { uint128 quotient = 0; uint128 remainder = 0; - DivModImpl(*this, other, "ient, &remainder); - *this = quotient; - return *this; + DivModImpl(lhs, rhs, "ient, &remainder); + return quotient; } -uint128& uint128::operator%=(uint128 other) { +uint128 operator%(uint128 lhs, uint128 rhs) { uint128 quotient = 0; uint128 remainder = 0; - DivModImpl(*this, other, "ient, &remainder); - *this = remainder; - return *this; + DivModImpl(lhs, rhs, "ient, &remainder); + return remainder; } namespace { |