summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Derek Mauro <dmauro@google.com>2022-09-02 06:54:22 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2022-09-02 06:55:23 -0700
commitb922dbefc4637d49fdde6305c3d991343041e66e (patch)
tree438750e1930a28c7aa1b64f8d2923739ff563d63
parent4a1ccf16ed98c876bf1e1985afb080baeff5101f (diff)
Remove the ABSL_HAVE_INTRINSIC_INT128 test from pcg_engine.h
In the time since pcg_engine.h was written, absl::uint128 was fixed to generate identical code to __uint128_t PiperOrigin-RevId: 471789541 Change-Id: Ibd1afc3e5e6d57af27cdd6a21171c96ea333161c
-rw-r--r--absl/random/internal/pcg_engine.h25
1 files changed, 2 insertions, 23 deletions
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));
}
};