2929
3030#include " common/compiler_util.h" // IWYU pragma: keep
3131#include " util/cpu_info.h"
32- #include " util/crc32c.h"
3332#include " util/hash/city.h"
3433#include " util/murmur_hash3.h"
3534#include " util/sse_util.hpp"
@@ -49,12 +48,7 @@ class HashUtil {
4948 return (uint32_t )crc32 (hash, (const unsigned char *)(&INT_VALUE), 4 );
5049 }
5150
52- // ATTN: crc32c's result is different with zlib_crc32 coz of different polynomial
53- // crc32c have better performance than zlib_crc32/crc_hash
54- static uint32_t crc32c_hash (const void * data, uint32_t bytes, uint32_t hash) {
55- return crc32c::Extend (hash, static_cast <const char *>(data), bytes);
56- }
57-
51+ #if defined(__SSE4_2__) || defined(__aarch64__)
5852 // Compute the Crc32 hash for data using SSE4 instructions. The input hash parameter is
5953 // the current hash/seed value.
6054 // This should only be called if SSE is supported.
@@ -64,8 +58,6 @@ class HashUtil {
6458 // NOTE: Any changes made to this function need to be reflected in Codegen::GetHashFn.
6559 // TODO: crc32 hashes with different seeds do not result in different hash functions.
6660 // The resulting hashes are correlated.
67- // ATTN: prefer do not use this function anymore, use crc32c_hash instead
68- // This function is retained because it is not certain whether there are compatibility issues with historical data.
6961 static uint32_t crc_hash (const void * data, uint32_t bytes, uint32_t hash) {
7062 if (!CpuInfo::is_supported (CpuInfo::SSE4_2)) {
7163 return zlib_crc_hash (data, bytes, hash);
@@ -124,6 +116,11 @@ class HashUtil {
124116
125117 return converter.u64 ;
126118 }
119+ #else
120+ static uint32_t crc_hash (const void * data, uint32_t bytes, uint32_t hash) {
121+ return zlib_crc_hash (data, bytes, hash);
122+ }
123+ #endif
127124
128125 // refer to https://github.com/apache/commons-codec/blob/master/src/main/java/org/apache/commons/codec/digest/MurmurHash3.java
129126 static const uint32_t MURMUR3_32_SEED = 104729 ;
0 commit comments