summaryrefslogtreecommitdiff
path: root/absl/numeric
diff options
context:
space:
mode:
Diffstat (limited to 'absl/numeric')
-rw-r--r--absl/numeric/int128.h12
1 files changed, 4 insertions, 8 deletions
diff --git a/absl/numeric/int128.h b/absl/numeric/int128.h
index a2ca29a0..8eca1e92 100644
--- a/absl/numeric/int128.h
+++ b/absl/numeric/int128.h
@@ -159,12 +159,12 @@ class alignas(16) uint128 {
// Uint128Low64()
//
// Returns the lower 64-bit value of a `uint128` value.
- friend uint64_t Uint128Low64(const uint128& v);
+ friend constexpr uint64_t Uint128Low64(const uint128& v);
// Uint128High64()
//
// Returns the higher 64-bit value of a `uint128` value.
- friend uint64_t Uint128High64(const uint128& v);
+ friend constexpr uint64_t Uint128High64(const uint128& v);
// MakeUInt128()
//
@@ -202,10 +202,6 @@ extern std::ostream& operator<<(std::ostream& o, const uint128& b);
// TODO(strel) add operator>>(std::istream&, uint128&)
-// Methods to access low and high pieces of 128-bit value.
-uint64_t Uint128Low64(const uint128& v);
-uint64_t Uint128High64(const uint128& v);
-
// TODO(absl-team): Implement signed 128-bit type
// --------------------------------------------------------------------------
@@ -283,9 +279,9 @@ inline uint128 operator%(const uint128& lhs, const uint128& rhs) {
return uint128(lhs) %= rhs;
}
-inline uint64_t Uint128Low64(const uint128& v) { return v.lo_; }
+constexpr uint64_t Uint128Low64(const uint128& v) { return v.lo_; }
-inline uint64_t Uint128High64(const uint128& v) { return v.hi_; }
+constexpr uint64_t Uint128High64(const uint128& v) { return v.hi_; }
// Constructors from integer types.