Moving byte order/memory access to poly.
This commit is contained in:
@@ -300,7 +300,7 @@ uint32_t xe_crc32(const void* data, size_t length, uint32_t previous_crc) {
|
||||
const uint32_t* current = (const uint32_t*)data;
|
||||
while (length >= 8) {
|
||||
#if XE_CPU_BIGENDIAN
|
||||
uint32_t one = *current++ ^ XESWAP32(crc);
|
||||
uint32_t one = *current++ ^ poly::byte_swap(crc);
|
||||
uint32_t two = *current++;
|
||||
crc = xe_crc32_lookup_[0][ two & 0xFF] ^
|
||||
xe_crc32_lookup_[1][(two>> 8) & 0xFF] ^
|
||||
|
||||
@@ -86,8 +86,8 @@ XEFORCEINLINE uint32_t UNALIGNED_LOAD32(const char *p) {
|
||||
#endif
|
||||
|
||||
#if XE_CPU_BIGENDIAN
|
||||
#define uint32_t_in_expected_order(x) (XESWAP32(x))
|
||||
#define uint64_in_expected_order(x) (XESWAP64(x))
|
||||
#define uint32_t_in_expected_order(x) (poly::byte_swap(x))
|
||||
#define uint64_in_expected_order(x) (poly::byte_swap(x))
|
||||
#else
|
||||
#define uint32_t_in_expected_order(x) (x)
|
||||
#define uint64_in_expected_order(x) (x)
|
||||
@@ -227,9 +227,9 @@ uint32_t CityHash32(const char *s, size_t len) {
|
||||
h = Rotate32(h, 19);
|
||||
h = h * 5 + 0xe6546b64;
|
||||
g ^= a4;
|
||||
g = XESWAP32(g) * 5;
|
||||
g = poly::byte_swap(g) * 5;
|
||||
h += a4 * 5;
|
||||
h = XESWAP32(h);
|
||||
h = poly::byte_swap(h);
|
||||
f += a0;
|
||||
PERMUTE3(f, h, g);
|
||||
s += 20;
|
||||
@@ -346,11 +346,11 @@ static uint64_t HashLen33to64(const char *s, size_t len) {
|
||||
uint64_t h = Fetch64(s + len - 16) * mul;
|
||||
uint64_t u = Rotate(a + g, 43) + (Rotate(b, 30) + c) * 9;
|
||||
uint64_t v = ((a + g) ^ d) + f + 1;
|
||||
uint64_t w = XESWAP64((u + v) * mul) + h;
|
||||
uint64_t w = poly::byte_swap((u + v) * mul) + h;
|
||||
uint64_t x = Rotate(e + f, 42) + c;
|
||||
uint64_t y = (XESWAP64((v + w) * mul) + g) * mul;
|
||||
uint64_t y = (poly::byte_swap((v + w) * mul) + g) * mul;
|
||||
uint64_t z = e + f + c;
|
||||
a = XESWAP64((x + z) * mul + y) + b;
|
||||
a = poly::byte_swap((x + z) * mul + y) + b;
|
||||
b = ShiftMix((z + a) * mul + d + h) * mul;
|
||||
return b + x;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user