summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--absl/container/inlined_vector.h7
-rw-r--r--absl/hash/CMakeLists.txt3
-rw-r--r--absl/random/internal/pcg_engine.h25
3 files changed, 8 insertions, 27 deletions
diff --git a/absl/container/inlined_vector.h b/absl/container/inlined_vector.h
index 42121228..08a47709 100644
--- a/absl/container/inlined_vector.h
+++ b/absl/container/inlined_vector.h
@@ -275,9 +275,10 @@ class InlinedVector {
size_type max_size() const noexcept {
// One bit of the size storage is used to indicate whether the inlined
// vector contains allocated memory. As a result, the maximum size that the
- // inlined vector can express is half of the max for
- // AllocatorTraits<A>::max_size();
- return AllocatorTraits<A>::max_size(storage_.GetAllocator()) / 2;
+ // inlined vector can express is the minimum of the limit of how many
+ // objects we can allocate and std::numeric_limits<size_type>::max() / 2.
+ return (std::min)(AllocatorTraits<A>::max_size(storage_.GetAllocator()),
+ (std::numeric_limits<size_type>::max)() / 2);
}
// `InlinedVector::capacity()`
diff --git a/absl/hash/CMakeLists.txt b/absl/hash/CMakeLists.txt
index 423b74b5..46365790 100644
--- a/absl/hash/CMakeLists.txt
+++ b/absl/hash/CMakeLists.txt
@@ -24,7 +24,7 @@ absl_cc_library(
"internal/hash.h"
COPTS
${ABSL_DEFAULT_COPTS}
- DEPS
+ DEPS
absl::city
absl::config
absl::core_headers
@@ -55,6 +55,7 @@ absl_cc_library(
absl::variant
GTest::gmock
TESTONLY
+ PUBLIC
)
absl_cc_test(
diff --git a/absl/random/internal/pcg_engine.h b/absl/random/internal/pcg_engine.h
index 4ab44c94..e1f4ef33 100644
--- a/absl/random/internal/pcg_engine.h
+++ b/absl/random/internal/pcg_engine.h
@@ -221,47 +221,26 @@ class pcg_engine {
template <uint64_t kMultA, uint64_t kMultB, uint64_t kIncA, uint64_t kIncB>
class pcg128_params {
public:
-#if ABSL_HAVE_INTRINSIC_INT128
- using state_type = __uint128_t;
- static inline constexpr state_type make_u128(uint64_t a, uint64_t b) {
- return (static_cast<__uint128_t>(a) << 64) | b;
- }
-#else
using state_type = absl::uint128;
- static inline constexpr state_type make_u128(uint64_t a, uint64_t b) {
- return absl::MakeUint128(a, b);
- }
-#endif
-
static inline constexpr state_type multiplier() {
- return make_u128(kMultA, kMultB);
+ return absl::MakeUint128(kMultA, kMultB);
}
static inline constexpr state_type increment() {
- return make_u128(kIncA, kIncB);
+ return absl::MakeUint128(kIncA, kIncB);
}
};
// Implementation of the PCG xsl_rr_128_64 128-bit mixing function, which
// accepts an input of state_type and mixes it into an output of result_type.
struct pcg_xsl_rr_128_64 {
-#if ABSL_HAVE_INTRINSIC_INT128
- using state_type = __uint128_t;
-#else
using state_type = absl::uint128;
-#endif
using result_type = uint64_t;
inline uint64_t operator()(state_type state) {
// This is equivalent to the xsl_rr_128_64 mixing function.
-#if ABSL_HAVE_INTRINSIC_INT128
uint64_t rotate = static_cast<uint64_t>(state >> 122u);
state ^= state >> 64;
uint64_t s = static_cast<uint64_t>(state);
-#else
- uint64_t h = Uint128High64(state);
- uint64_t rotate = h >> 58u;
- uint64_t s = Uint128Low64(state) ^ h;
-#endif
return rotr(s, static_cast<int>(rotate));
}
};