summaryrefslogtreecommitdiff
path: root/Source/Core/Common/Hash.cpp
diff options
context:
space:
mode:
authorMarkus Wick <degasus@users.noreply.github.com>2018-04-02 12:18:22 +0200
committerGitHub <noreply@github.com>2018-04-02 12:18:22 +0200
commit2449be7f0c9b646b0b1110b6e3ad80a77bd8a1f7 (patch)
tree5d3cc85e9019af52e830f2f3d4cd208c6a1cf078 /Source/Core/Common/Hash.cpp
parentdea30e08bf03aaa465a0b5c4d6f0c7195bed461a (diff)
parent136f16599f5545f1ff286ad452edee508f204564 (diff)
Merge pull request #6571 from lioncash/rotate
CommonFuncs: Generify rotation functions and move them to BitUtils.h
Diffstat (limited to 'Source/Core/Common/Hash.cpp')
-rw-r--r--Source/Core/Common/Hash.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/Source/Core/Common/Hash.cpp b/Source/Core/Common/Hash.cpp
index 7074e12e55..2678ab89bc 100644
--- a/Source/Core/Common/Hash.cpp
+++ b/Source/Core/Common/Hash.cpp
@@ -3,8 +3,10 @@
// Refer to the license.txt file included.
#include "Common/Hash.h"
+
#include <algorithm>
#include <cstring>
+#include "Common/BitUtils.h"
#include "Common/CPUDetect.h"
#include "Common/CommonFuncs.h"
#include "Common/Intrinsics.h"
@@ -117,15 +119,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 = _rotl64(k1, 23);
+ k1 = Common::RotateLeft(k1, 23);
k1 *= c2;
h1 ^= k1;
h1 += h2;
- h2 = _rotl64(h2, 41);
+ h2 = Common::RotateLeft(h2, 41);
k2 *= c2;
- k2 = _rotl64(k2, 23);
+ k2 = Common::RotateLeft(k2, 23);
k2 *= c1;
h2 ^= k2;
h2 += h1;
@@ -396,15 +398,15 @@ static u32 fmix32(u32 h)
static void bmix32(u32& h1, u32& h2, u32& k1, u32& k2, u32& c1, u32& c2)
{
k1 *= c1;
- k1 = _rotl(k1, 11);
+ k1 = Common::RotateLeft(k1, 11);
k1 *= c2;
h1 ^= k1;
h1 += h2;
- h2 = _rotl(h2, 17);
+ h2 = Common::RotateLeft(h2, 17);
k2 *= c2;
- k2 = _rotl(k2, 11);
+ k2 = Common::RotateLeft(k2, 11);
k2 *= c1;
h2 ^= k2;
h2 += h1;