Skip to content

Commit 2a3810e

Browse files
committed
Remove unused xxHash64
Now that there are no more users of xxHash64, remove it. Signed-off-by: Kees Cook <[email protected]>
1 parent c980067 commit 2a3810e

File tree

3 files changed

+0
-89
lines changed

3 files changed

+0
-89
lines changed

llvm/include/llvm/Support/xxhash.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@
4444

4545
namespace llvm {
4646

47-
LLVM_ABI uint64_t xxHash64(llvm::StringRef Data);
48-
LLVM_ABI uint64_t xxHash64(llvm::ArrayRef<uint8_t> Data);
49-
5047
LLVM_ABI uint64_t xxh3_64bits(ArrayRef<uint8_t> data);
5148
inline uint64_t xxh3_64bits(StringRef data) {
5249
return xxh3_64bits(ArrayRef(data.bytes_begin(), data.size()));

llvm/lib/Support/xxhash.cpp

Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -77,20 +77,6 @@ static const uint64_t PRIME64_3 = 1609587929392839161ULL;
7777
static const uint64_t PRIME64_4 = 9650029242287828579ULL;
7878
static const uint64_t PRIME64_5 = 2870177450012600261ULL;
7979

80-
static uint64_t round(uint64_t Acc, uint64_t Input) {
81-
Acc += Input * PRIME64_2;
82-
Acc = rotl64(Acc, 31);
83-
Acc *= PRIME64_1;
84-
return Acc;
85-
}
86-
87-
static uint64_t mergeRound(uint64_t Acc, uint64_t Val) {
88-
Val = round(0, Val);
89-
Acc ^= Val;
90-
Acc = Acc * PRIME64_1 + PRIME64_4;
91-
return Acc;
92-
}
93-
9480
static uint64_t XXH64_avalanche(uint64_t hash) {
9581
hash ^= hash >> 33;
9682
hash *= PRIME64_2;
@@ -100,70 +86,6 @@ static uint64_t XXH64_avalanche(uint64_t hash) {
10086
return hash;
10187
}
10288

103-
uint64_t llvm::xxHash64(StringRef Data) {
104-
size_t Len = Data.size();
105-
uint64_t Seed = 0;
106-
const unsigned char *P = Data.bytes_begin();
107-
const unsigned char *const BEnd = Data.bytes_end();
108-
uint64_t H64;
109-
110-
if (Len >= 32) {
111-
const unsigned char *const Limit = BEnd - 32;
112-
uint64_t V1 = Seed + PRIME64_1 + PRIME64_2;
113-
uint64_t V2 = Seed + PRIME64_2;
114-
uint64_t V3 = Seed + 0;
115-
uint64_t V4 = Seed - PRIME64_1;
116-
117-
do {
118-
V1 = round(V1, endian::read64le(P));
119-
P += 8;
120-
V2 = round(V2, endian::read64le(P));
121-
P += 8;
122-
V3 = round(V3, endian::read64le(P));
123-
P += 8;
124-
V4 = round(V4, endian::read64le(P));
125-
P += 8;
126-
} while (P <= Limit);
127-
128-
H64 = rotl64(V1, 1) + rotl64(V2, 7) + rotl64(V3, 12) + rotl64(V4, 18);
129-
H64 = mergeRound(H64, V1);
130-
H64 = mergeRound(H64, V2);
131-
H64 = mergeRound(H64, V3);
132-
H64 = mergeRound(H64, V4);
133-
134-
} else {
135-
H64 = Seed + PRIME64_5;
136-
}
137-
138-
H64 += (uint64_t)Len;
139-
140-
while (reinterpret_cast<uintptr_t>(P) + 8 <=
141-
reinterpret_cast<uintptr_t>(BEnd)) {
142-
uint64_t const K1 = round(0, endian::read64le(P));
143-
H64 ^= K1;
144-
H64 = rotl64(H64, 27) * PRIME64_1 + PRIME64_4;
145-
P += 8;
146-
}
147-
148-
if (reinterpret_cast<uintptr_t>(P) + 4 <= reinterpret_cast<uintptr_t>(BEnd)) {
149-
H64 ^= (uint64_t)(endian::read32le(P)) * PRIME64_1;
150-
H64 = rotl64(H64, 23) * PRIME64_2 + PRIME64_3;
151-
P += 4;
152-
}
153-
154-
while (P < BEnd) {
155-
H64 ^= (*P) * PRIME64_5;
156-
H64 = rotl64(H64, 11) * PRIME64_1;
157-
P++;
158-
}
159-
160-
return XXH64_avalanche(H64);
161-
}
162-
163-
uint64_t llvm::xxHash64(ArrayRef<uint8_t> Data) {
164-
return xxHash64({(const char *)Data.data(), Data.size()});
165-
}
166-
16789
constexpr size_t XXH3_SECRETSIZE_MIN = 136;
16890
constexpr size_t XXH_SECRET_DEFAULT_SIZE = 192;
16991

llvm/unittests/Support/xxhashTest.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,6 @@ static void fillTestBuffer(uint8_t *buffer, size_t len) {
3131
}
3232
}
3333

34-
TEST(xxhashTest, Basic) {
35-
EXPECT_EQ(0xef46db3751d8e999U, xxHash64(StringRef()));
36-
EXPECT_EQ(0x33bf00a859c4ba3fU, xxHash64("foo"));
37-
EXPECT_EQ(0x48a37c90ad27a659U, xxHash64("bar"));
38-
EXPECT_EQ(0x69196c1b3af0bff9U,
39-
xxHash64("0123456789abcdefghijklmnopqrstuvwxyz"));
40-
}
41-
4234
TEST(xxhashTest, xxh3) {
4335
constexpr size_t size = 2243;
4436
uint8_t a[size];

0 commit comments

Comments
 (0)