Changes imported from Abseil "staging" branch:
- 55a89fda61ddf8aa76d0a3b6bc44bf6b5b6eadfc Internal cleanup by Abseil Team <absl-team@google.com> - b7646f979ee40c5716833692f2eb24b8058cf4c8 Internal cleanup by Gennadiy Rozental <rogeeff@google.com> - 12a4051b0ea91c6a6211f738fa24e1bc7064c09a Merging changes from https://github.com/abseil/abseil-cpp... by Daniel Katz <katzdm@google.com> - 2e259588d62118a70837a3d8408cb6c763f48420 Replace EXPECT_TRUE(StrContains(...)) with an assert exam... by Abseil Team <absl-team@google.com> - 8f7d251b3486f2b03dc712ad0822b9dc87a7964b Make Uint128(High|Low)64 constexpr. by Alex Strelnikov <strel@google.com> - 955fd38a23896e003105defc0ef221a2c10d392e Internal change by Jon Cohen <cohenjon@google.com> GitOrigin-RevId: 55a89fda61ddf8aa76d0a3b6bc44bf6b5b6eadfc Change-Id: Ia062fe8a0559aa3ace3736d2a53f6da13af40b2c
This commit is contained in:
parent
badd8bd27f
commit
9850abf25d
4 changed files with 10 additions and 10 deletions
|
@ -28,7 +28,10 @@ cc_library(
|
||||||
name = "memory",
|
name = "memory",
|
||||||
hdrs = ["memory.h"],
|
hdrs = ["memory.h"],
|
||||||
copts = ABSL_DEFAULT_COPTS,
|
copts = ABSL_DEFAULT_COPTS,
|
||||||
deps = ["//absl/meta:type_traits"],
|
deps = [
|
||||||
|
"//absl/base:core_headers",
|
||||||
|
"//absl/meta:type_traits",
|
||||||
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
cc_test(
|
cc_test(
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
#include "absl/base/macros.h"
|
||||||
#include "absl/meta/type_traits.h"
|
#include "absl/meta/type_traits.h"
|
||||||
|
|
||||||
namespace absl {
|
namespace absl {
|
||||||
|
|
|
@ -159,12 +159,12 @@ class alignas(16) uint128 {
|
||||||
// Uint128Low64()
|
// Uint128Low64()
|
||||||
//
|
//
|
||||||
// Returns the lower 64-bit value of a `uint128` value.
|
// 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()
|
// Uint128High64()
|
||||||
//
|
//
|
||||||
// Returns the higher 64-bit value of a `uint128` value.
|
// 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()
|
// MakeUInt128()
|
||||||
//
|
//
|
||||||
|
@ -202,10 +202,6 @@ extern std::ostream& operator<<(std::ostream& o, const uint128& b);
|
||||||
|
|
||||||
// TODO(strel) add operator>>(std::istream&, uint128&)
|
// 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
|
// 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;
|
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.
|
// Constructors from integer types.
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
// Examples:
|
// Examples:
|
||||||
// std::string s = "foo";
|
// std::string s = "foo";
|
||||||
// absl::string_view sv = "f";
|
// absl::string_view sv = "f";
|
||||||
// EXPECT_TRUE(absl::StrContains(s, sv));
|
// assert(absl::StrContains(s, sv));
|
||||||
//
|
//
|
||||||
// Note: The order of parameters in these functions is designed to mimic the
|
// Note: The order of parameters in these functions is designed to mimic the
|
||||||
// order an equivalent member function would exhibit;
|
// order an equivalent member function would exhibit;
|
||||||
|
|
Loading…
Reference in a new issue