diff options
| author | JosJuice <josjuice@gmail.com> | 2022-08-05 15:39:00 +0200 |
|---|---|---|
| committer | JosJuice <josjuice@gmail.com> | 2022-12-11 08:59:18 +0100 |
| commit | 454537d53efd0579d4cd2a48108f3bdb490b08d2 (patch) | |
| tree | 46f88704bd7fc520d7462d78fe39a4b0c8924153 /Source/Core/Common/Hash.cpp | |
| parent | 48ce5318e1997d02e5544b9ad0b867b055f6fa63 (diff) | |
Replace BitUtils with C++20: RotateLeft/RotateRight
Now that we've flipped the C++20 switch, let's start making use of
the nice new <bit> header.
I'm planning on handling this move away from BitUtils.h incrementally
in a series of PRs. There may be a few functions remaining in
BitUtils.h by the end that C++20 doesn't have any equivalents for.
Diffstat (limited to 'Source/Core/Common/Hash.cpp')
| -rw-r--r-- | Source/Core/Common/Hash.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Source/Core/Common/Hash.cpp b/Source/Core/Common/Hash.cpp index f11ac4d62c..e6b421e96f 100644 --- a/Source/Core/Common/Hash.cpp +++ b/Source/Core/Common/Hash.cpp @@ -4,7 +4,9 @@ #include "Common/Hash.h" #include <algorithm> +#include <bit> #include <cstring> + #include <zlib.h> #include "Common/BitUtils.h" @@ -60,15 +62,15 @@ static u64 getblock(const u64* p, int i) static void bmix64(u64& h1, u64& h2, u64& k1, u64& k2, u64& c1, u64& c2) { k1 *= c1; - k1 = Common::RotateLeft(k1, 23); + k1 = std::rotl(k1, 23); k1 *= c2; h1 ^= k1; h1 += h2; - h2 = Common::RotateLeft(h2, 41); + h2 = std::rotl(h2, 41); k2 *= c2; - k2 = Common::RotateLeft(k2, 23); + k2 = std::rotl(k2, 23); k2 *= c1; h2 ^= k2; h2 += h1; |
