File tree Expand file tree Collapse file tree 2 files changed +5
-9
lines changed
test/src/__support/HashTable Expand file tree Collapse file tree 2 files changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -339,19 +339,15 @@ struct HashTable {
339
339
iterator end () const { return {0 , 0 , {0 }, *this }; }
340
340
341
341
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);
345
343
ENTRY &entry = this ->entry (find (key, primary));
346
344
if (entry.key == nullptr )
347
345
return nullptr ;
348
346
return &entry;
349
347
}
350
348
351
349
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 );
355
351
return insert (table, item, primary);
356
352
}
357
353
};
Original file line number Diff line number Diff line change 11
11
namespace LIBC_NAMESPACE {
12
12
namespace internal {
13
13
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 >;
16
16
17
17
TEST (LlvmLibcHashTableBitMaskTest, SingleBitStrideLowestSetBit) {
18
18
uint16_t data = 0xffff ;
@@ -53,7 +53,7 @@ TEST(LlvmLibcHashTableBitMaskTest, SingleBitStrideIteration) {
53
53
54
54
TEST (LlvmLibcHashTableBitMaskTest, MultiBitStrideIteration) {
55
55
using Iter = IteratableBitMaskAdaptor<LargeBitMask>;
56
- uint64_t data = Iter::MASK ;
56
+ uint64_t data = 0x8080808080808080ul ;
57
57
for (size_t i = 0 ; i < 8 ; ++i) {
58
58
Iter iter = {data};
59
59
size_t j = i;
You can’t perform that action at this time.
0 commit comments