Skip to content

Commit 2557de3

Browse files
fix build errors
1 parent 3ab2f8b commit 2557de3

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

libc/src/__support/HashTable/table.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -339,19 +339,15 @@ struct HashTable {
339339
iterator end() const { return {0, 0, {0}, *this}; }
340340

341341
LIBC_INLINE ENTRY *find(const char *key) {
342-
LIBC_NAMESPACE::internal::HashState hasher = state;
343-
hasher.update(key, strlen(key));
344-
uint64_t primary = hasher.finish();
342+
uint64_t primary = oneshot_hash(key);
345343
ENTRY &entry = this->entry(find(key, primary));
346344
if (entry.key == nullptr)
347345
return nullptr;
348346
return &entry;
349347
}
350348

351349
LIBC_INLINE static ENTRY *insert(HashTable *&table, ENTRY item) {
352-
LIBC_NAMESPACE::internal::HashState hasher = table->state;
353-
hasher.update(item.key, strlen(item.key));
354-
uint64_t primary = hasher.finish();
350+
uint64_t primary = table->oneshot_hash(item.key);
355351
return insert(table, item, primary);
356352
}
357353
};

libc/test/src/__support/HashTable/bitmask_test.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
namespace LIBC_NAMESPACE {
1212
namespace internal {
1313

14-
using ShortBitMask = BitMaskAdaptor<uint16_t, 0xffff, 1>;
15-
using LargeBitMask = BitMaskAdaptor<uint64_t, 0x80'80'80'80'80'80'80'80, 8>;
14+
using ShortBitMask = BitMaskAdaptor<uint16_t, 1>;
15+
using LargeBitMask = BitMaskAdaptor<uint64_t, 8>;
1616

1717
TEST(LlvmLibcHashTableBitMaskTest, SingleBitStrideLowestSetBit) {
1818
uint16_t data = 0xffff;
@@ -53,7 +53,7 @@ TEST(LlvmLibcHashTableBitMaskTest, SingleBitStrideIteration) {
5353

5454
TEST(LlvmLibcHashTableBitMaskTest, MultiBitStrideIteration) {
5555
using Iter = IteratableBitMaskAdaptor<LargeBitMask>;
56-
uint64_t data = Iter::MASK;
56+
uint64_t data = 0x8080808080808080ul;
5757
for (size_t i = 0; i < 8; ++i) {
5858
Iter iter = {data};
5959
size_t j = i;

0 commit comments

Comments
 (0)