diff options
author | Colin Cross <ccross@android.com> | 2022-04-13 01:22:24 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2022-04-13 01:22:24 +0000 |
commit | a9167328fc721c9637f0bcd87525cd23ff5ddac1 (patch) | |
tree | 2ce94d7f0804ccb77d1fa9b2a1bca00eecdff1e2 /third_party/abseil-cpp/absl/random/internal/fastmath.h | |
parent | 7d5c00bbb9ff7b14de493bfa0ea56d4993f2e187 (diff) | |
parent | 2f9c4b2c3bdefdfda50f145f6de999bc76327337 (diff) | |
download | webrtc-a9167328fc721c9637f0bcd87525cd23ff5ddac1.tar.gz |
Merge changes I0ab600cd,I1e74c64a am: 798f3afdf6 am: 2f9c4b2c3b
Original change: https://android-review.googlesource.com/c/platform/external/webrtc/+/2062410
Change-Id: I95fedf2237deb626f888e92e7fd42544b2906b61
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'third_party/abseil-cpp/absl/random/internal/fastmath.h')
-rw-r--r-- | third_party/abseil-cpp/absl/random/internal/fastmath.h | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/third_party/abseil-cpp/absl/random/internal/fastmath.h b/third_party/abseil-cpp/absl/random/internal/fastmath.h index 6baeb5a7c9..963b7690f1 100644 --- a/third_party/abseil-cpp/absl/random/internal/fastmath.h +++ b/third_party/abseil-cpp/absl/random/internal/fastmath.h @@ -22,27 +22,22 @@ #include <cmath> #include <cstdint> -#include "absl/base/internal/bits.h" +#include "absl/numeric/bits.h" namespace absl { ABSL_NAMESPACE_BEGIN namespace random_internal { -// Returns the position of the first bit set. -inline int LeadingSetBit(uint64_t n) { - return 64 - base_internal::CountLeadingZeros64(n); -} - // Compute log2(n) using integer operations. // While std::log2 is more accurate than std::log(n) / std::log(2), for // very large numbers--those close to std::numeric_limits<uint64_t>::max() - 2, // for instance--std::log2 rounds up rather than down, which introduces // definite skew in the results. inline int IntLog2Floor(uint64_t n) { - return (n <= 1) ? 0 : (63 - base_internal::CountLeadingZeros64(n)); + return (n <= 1) ? 0 : (63 - countl_zero(n)); } inline int IntLog2Ceil(uint64_t n) { - return (n <= 1) ? 0 : (64 - base_internal::CountLeadingZeros64(n - 1)); + return (n <= 1) ? 0 : (64 - countl_zero(n - 1)); } inline double StirlingLogFactorial(double n) { @@ -55,18 +50,6 @@ inline double StirlingLogFactorial(double n) { (1.0 / 360.0) * ninv * ninv * ninv; } -// Rotate value right. -// -// We only implement the uint32_t / uint64_t versions because -// 1) those are the only ones we use, and -// 2) those are the only ones where clang detects the rotate idiom correctly. -inline constexpr uint32_t rotr(uint32_t value, uint8_t bits) { - return (value >> (bits & 31)) | (value << ((-bits) & 31)); -} -inline constexpr uint64_t rotr(uint64_t value, uint8_t bits) { - return (value >> (bits & 63)) | (value << ((-bits) & 63)); -} - } // namespace random_internal ABSL_NAMESPACE_END } // namespace absl |