authorgravatar for spexguy070@gmail.comMartin Wickham <spexguy070@gmail.com> 2021-07-06 00:57:46-05:00
committergravatar for spexguy070@gmail.comMartin Wickham <spexguy070@gmail.com> 2021-07-06 00:57:46-05:00
logf02ee7a9f5a72f24a645f36db7ae7828f29d3393
tree36be57235e8deeee673e6e58395f1ae7280a8cd4
parent149ecdfe1b5149c46a58dffe670b36319983ad7f

Avoid some large copies for another second of time saved


5 files changed, 145 insertions(+), 115 deletions(-)

src/stage1/all_types.hpp+4-4
......@@ -1879,8 +1879,8 @@ struct TypeId {
18791879 } data;
18801880};
18811881
1882uint32_t type_id_hash(TypeId);
1883bool type_id_eql(TypeId a, TypeId b);
1882uint32_t type_id_hash(TypeId const *);
1883bool type_id_eql(TypeId const *a, TypeId const *b);
18841884
18851885enum ZigLLVMFnId {
18861886 ZigLLVMFnIdCtz,
......@@ -1935,8 +1935,8 @@ struct ZigLLVMFnKey {
19351935 } data;
19361936};
19371937
1938uint32_t zig_llvm_fn_key_hash(ZigLLVMFnKey);
1939bool zig_llvm_fn_key_eql(ZigLLVMFnKey a, ZigLLVMFnKey b);
1938uint32_t zig_llvm_fn_key_hash(ZigLLVMFnKey const *);
1939bool zig_llvm_fn_key_eql(ZigLLVMFnKey const *a, ZigLLVMFnKey const *b);
19401940
19411941struct TimeEvent {
19421942 double time;
src/stage1/analyze.cpp+96-92
......@@ -7742,9 +7742,9 @@ ZigType *make_int_type(CodeGen *g, bool is_signed, uint32_t size_in_bits) {
77427742 return entry;
77437743}
77447744
7745uint32_t type_id_hash(TypeId x) {
7746 uint32_t hash = hash_combine(HASH_INIT, &x.id);
7747 switch (x.id) {
7745uint32_t type_id_hash(TypeId const *x) {
7746 uint32_t hash = hash_combine(HASH_INIT, &x->id);
7747 switch (x->id) {
77487748 case ZigTypeIdInvalid:
77497749 case ZigTypeIdOpaque:
77507750 case ZigTypeIdMetaType:
......@@ -7768,46 +7768,50 @@ uint32_t type_id_hash(TypeId x) {
77687768 case ZigTypeIdAnyFrame:
77697769 zig_unreachable();
77707770 case ZigTypeIdErrorUnion:
7771 hash = hash_combine(hash, &x.data.error_union.err_set_type);
7772 hash = hash_combine(hash, &x.data.error_union.payload_type);
7771 hash = hash_combine(hash, &x->data.error_union.err_set_type);
7772 hash = hash_combine(hash, &x->data.error_union.payload_type);
77737773 return hash;
77747774 case ZigTypeIdPointer:
7775 hash = hash_combine(hash, &x.data.pointer.child_type);
7776 hash = hash_combine(hash, &x.data.pointer.ptr_len);
7777 hash = hash_combine(hash, &x.data.pointer.is_const);
7778 hash = hash_combine(hash, &x.data.pointer.is_volatile);
7779 hash = hash_combine(hash, &x.data.pointer.allow_zero);
7780 hash = hash_combine(hash, &x.data.pointer.alignment);
7781 hash = hash_combine(hash, &x.data.pointer.bit_offset_in_host);
7782 hash = hash_combine(hash, &x.data.pointer.vector_index);
7783 hash = hash_combine(hash, &x.data.pointer.host_int_bytes);
7784 if (x.data.pointer.sentinel != nullptr) {
7785 hash = hash_combine_const_val(hash, x.data.pointer.sentinel);
7775 hash = hash_combine(hash, &x->data.pointer.child_type);
7776 hash = hash_combine(hash, &x->data.pointer.ptr_len);
7777 hash = hash_combine(hash, &x->data.pointer.is_const);
7778 hash = hash_combine(hash, &x->data.pointer.is_volatile);
7779 hash = hash_combine(hash, &x->data.pointer.allow_zero);
7780 hash = hash_combine(hash, &x->data.pointer.alignment);
7781 hash = hash_combine(hash, &x->data.pointer.bit_offset_in_host);
7782 hash = hash_combine(hash, &x->data.pointer.vector_index);
7783 hash = hash_combine(hash, &x->data.pointer.host_int_bytes);
7784 if (x->data.pointer.sentinel != nullptr) {
7785 hash = hash_combine_const_val(hash, x->data.pointer.sentinel);
7786 }
7787 if (x->data.pointer.inferred_struct_field) {
7788 hash = hash_combine(hash, &x->data.pointer.inferred_struct_field->inferred_struct_type);
7789 hash = hash_combine_buf(hash, x->data.pointer.inferred_struct_field->field_name);
77867790 }
77877791 return hash;
77887792 case ZigTypeIdArray:
7789 hash = hash_combine(hash, &x.data.array.child_type);
7790 hash = hash_combine(hash, &x.data.array.size);
7791 if (x.data.array.sentinel != nullptr) {
7792 hash = hash_combine_const_val(hash, x.data.array.sentinel);
7793 hash = hash_combine(hash, &x->data.array.child_type);
7794 hash = hash_combine(hash, &x->data.array.size);
7795 if (x->data.array.sentinel != nullptr) {
7796 hash = hash_combine_const_val(hash, x->data.array.sentinel);
77937797 }
77947798 return hash;
77957799 case ZigTypeIdInt:
7796 hash = hash_combine(hash, &x.data.integer.is_signed);
7797 hash = hash_combine(hash, &x.data.integer.bit_count);
7800 hash = hash_combine(hash, &x->data.integer.is_signed);
7801 hash = hash_combine(hash, &x->data.integer.bit_count);
77987802 return hash;
77997803 case ZigTypeIdVector:
7800 hash = hash_combine(hash, &x.data.vector.elem_type);
7801 hash = hash_combine(hash, &x.data.vector.len);
7804 hash = hash_combine(hash, &x->data.vector.elem_type);
7805 hash = hash_combine(hash, &x->data.vector.len);
78027806 return hash;
78037807 }
78047808 zig_unreachable();
78057809}
78067810
7807bool type_id_eql(TypeId a, TypeId b) {
7808 if (a.id != b.id)
7811bool type_id_eql(TypeId const *a, TypeId const *b) {
7812 if (a->id != b->id)
78097813 return false;
7810 switch (a.id) {
7814 switch (a->id) {
78117815 case ZigTypeIdInvalid:
78127816 case ZigTypeIdMetaType:
78137817 case ZigTypeIdVoid:
......@@ -7831,107 +7835,107 @@ bool type_id_eql(TypeId a, TypeId b) {
78317835 case ZigTypeIdAnyFrame:
78327836 zig_unreachable();
78337837 case ZigTypeIdErrorUnion:
7834 return a.data.error_union.err_set_type == b.data.error_union.err_set_type &&
7835 a.data.error_union.payload_type == b.data.error_union.payload_type;
7838 return a->data.error_union.err_set_type == b->data.error_union.err_set_type &&
7839 a->data.error_union.payload_type == b->data.error_union.payload_type;
78367840
78377841 case ZigTypeIdPointer:
7838 return a.data.pointer.child_type == b.data.pointer.child_type &&
7839 a.data.pointer.ptr_len == b.data.pointer.ptr_len &&
7840 a.data.pointer.is_const == b.data.pointer.is_const &&
7841 a.data.pointer.is_volatile == b.data.pointer.is_volatile &&
7842 a.data.pointer.allow_zero == b.data.pointer.allow_zero &&
7843 a.data.pointer.alignment == b.data.pointer.alignment &&
7844 a.data.pointer.bit_offset_in_host == b.data.pointer.bit_offset_in_host &&
7845 a.data.pointer.vector_index == b.data.pointer.vector_index &&
7846 a.data.pointer.host_int_bytes == b.data.pointer.host_int_bytes &&
7842 return a->data.pointer.child_type == b->data.pointer.child_type &&
7843 a->data.pointer.ptr_len == b->data.pointer.ptr_len &&
7844 a->data.pointer.is_const == b->data.pointer.is_const &&
7845 a->data.pointer.is_volatile == b->data.pointer.is_volatile &&
7846 a->data.pointer.allow_zero == b->data.pointer.allow_zero &&
7847 a->data.pointer.alignment == b->data.pointer.alignment &&
7848 a->data.pointer.bit_offset_in_host == b->data.pointer.bit_offset_in_host &&
7849 a->data.pointer.vector_index == b->data.pointer.vector_index &&
7850 a->data.pointer.host_int_bytes == b->data.pointer.host_int_bytes &&
78477851 (
7848 a.data.pointer.sentinel == b.data.pointer.sentinel ||
7849 (a.data.pointer.sentinel != nullptr && b.data.pointer.sentinel != nullptr &&
7850 const_values_equal(a.data.pointer.codegen, a.data.pointer.sentinel, b.data.pointer.sentinel))
7852 a->data.pointer.sentinel == b->data.pointer.sentinel ||
7853 (a->data.pointer.sentinel != nullptr && b->data.pointer.sentinel != nullptr &&
7854 const_values_equal(a->data.pointer.codegen, a->data.pointer.sentinel, b->data.pointer.sentinel))
78517855 ) &&
78527856 (
7853 a.data.pointer.inferred_struct_field == b.data.pointer.inferred_struct_field ||
7854 (a.data.pointer.inferred_struct_field != nullptr &&
7855 b.data.pointer.inferred_struct_field != nullptr &&
7856 a.data.pointer.inferred_struct_field->inferred_struct_type ==
7857 b.data.pointer.inferred_struct_field->inferred_struct_type &&
7858 buf_eql_buf(a.data.pointer.inferred_struct_field->field_name,
7859 b.data.pointer.inferred_struct_field->field_name))
7857 a->data.pointer.inferred_struct_field == b->data.pointer.inferred_struct_field ||
7858 (a->data.pointer.inferred_struct_field != nullptr &&
7859 b->data.pointer.inferred_struct_field != nullptr &&
7860 a->data.pointer.inferred_struct_field->inferred_struct_type ==
7861 b->data.pointer.inferred_struct_field->inferred_struct_type &&
7862 buf_eql_buf(a->data.pointer.inferred_struct_field->field_name,
7863 b->data.pointer.inferred_struct_field->field_name))
78607864 );
78617865 case ZigTypeIdArray:
7862 return a.data.array.child_type == b.data.array.child_type &&
7863 a.data.array.size == b.data.array.size &&
7866 return a->data.array.child_type == b->data.array.child_type &&
7867 a->data.array.size == b->data.array.size &&
78647868 (
7865 a.data.array.sentinel == b.data.array.sentinel ||
7866 (a.data.array.sentinel != nullptr && b.data.array.sentinel != nullptr &&
7867 const_values_equal(a.data.array.codegen, a.data.array.sentinel, b.data.array.sentinel))
7869 a->data.array.sentinel == b->data.array.sentinel ||
7870 (a->data.array.sentinel != nullptr && b->data.array.sentinel != nullptr &&
7871 const_values_equal(a->data.array.codegen, a->data.array.sentinel, b->data.array.sentinel))
78687872 );
78697873 case ZigTypeIdInt:
7870 return a.data.integer.is_signed == b.data.integer.is_signed &&
7871 a.data.integer.bit_count == b.data.integer.bit_count;
7874 return a->data.integer.is_signed == b->data.integer.is_signed &&
7875 a->data.integer.bit_count == b->data.integer.bit_count;
78727876 case ZigTypeIdVector:
7873 return a.data.vector.elem_type == b.data.vector.elem_type &&
7874 a.data.vector.len == b.data.vector.len;
7877 return a->data.vector.elem_type == b->data.vector.elem_type &&
7878 a->data.vector.len == b->data.vector.len;
78757879 }
78767880 zig_unreachable();
78777881}
78787882
7879uint32_t zig_llvm_fn_key_hash(ZigLLVMFnKey x) {
7880 switch (x.id) {
7883uint32_t zig_llvm_fn_key_hash(ZigLLVMFnKey const *x) {
7884 switch (x->id) {
78817885 case ZigLLVMFnIdCtz:
7882 return (uint32_t)(x.data.ctz.bit_count) * (uint32_t)810453934;
7886 return (uint32_t)(x->data.ctz.bit_count) * (uint32_t)810453934;
78837887 case ZigLLVMFnIdClz:
7884 return (uint32_t)(x.data.clz.bit_count) * (uint32_t)2428952817;
7888 return (uint32_t)(x->data.clz.bit_count) * (uint32_t)2428952817;
78857889 case ZigLLVMFnIdPopCount:
7886 return (uint32_t)(x.data.clz.bit_count) * (uint32_t)101195049;
7890 return (uint32_t)(x->data.clz.bit_count) * (uint32_t)101195049;
78877891 case ZigLLVMFnIdFloatOp:
7888 return (uint32_t)(x.data.floating.bit_count) * ((uint32_t)x.id + 1025) +
7889 (uint32_t)(x.data.floating.vector_len) * (((uint32_t)x.id << 5) + 1025) +
7890 (uint32_t)(x.data.floating.op) * (uint32_t)43789879;
7892 return (uint32_t)(x->data.floating.bit_count) * ((uint32_t)x->id + 1025) +
7893 (uint32_t)(x->data.floating.vector_len) * (((uint32_t)x->id << 5) + 1025) +
7894 (uint32_t)(x->data.floating.op) * (uint32_t)43789879;
78917895 case ZigLLVMFnIdFMA:
7892 return (uint32_t)(x.data.floating.bit_count) * ((uint32_t)x.id + 1025) +
7893 (uint32_t)(x.data.floating.vector_len) * (((uint32_t)x.id << 5) + 1025);
7896 return (uint32_t)(x->data.floating.bit_count) * ((uint32_t)x->id + 1025) +
7897 (uint32_t)(x->data.floating.vector_len) * (((uint32_t)x->id << 5) + 1025);
78947898 case ZigLLVMFnIdBswap:
7895 return (uint32_t)(x.data.bswap.bit_count) * ((uint32_t)3661994335) +
7896 (uint32_t)(x.data.bswap.vector_len) * (((uint32_t)x.id << 5) + 1025);
7899 return (uint32_t)(x->data.bswap.bit_count) * ((uint32_t)3661994335) +
7900 (uint32_t)(x->data.bswap.vector_len) * (((uint32_t)x->id << 5) + 1025);
78977901 case ZigLLVMFnIdBitReverse:
7898 return (uint32_t)(x.data.bit_reverse.bit_count) * (uint32_t)2621398431;
7902 return (uint32_t)(x->data.bit_reverse.bit_count) * (uint32_t)2621398431;
78997903 case ZigLLVMFnIdOverflowArithmetic:
7900 return ((uint32_t)(x.data.overflow_arithmetic.bit_count) * 87135777) +
7901 ((uint32_t)(x.data.overflow_arithmetic.add_sub_mul) * 31640542) +
7902 ((uint32_t)(x.data.overflow_arithmetic.is_signed) ? 1062315172 : 314955820) +
7903 x.data.overflow_arithmetic.vector_len * 1435156945;
7904 return ((uint32_t)(x->data.overflow_arithmetic.bit_count) * 87135777) +
7905 ((uint32_t)(x->data.overflow_arithmetic.add_sub_mul) * 31640542) +
7906 ((uint32_t)(x->data.overflow_arithmetic.is_signed) ? 1062315172 : 314955820) +
7907 x->data.overflow_arithmetic.vector_len * 1435156945;
79047908 }
79057909 zig_unreachable();
79067910}
79077911
7908bool zig_llvm_fn_key_eql(ZigLLVMFnKey a, ZigLLVMFnKey b) {
7909 if (a.id != b.id)
7912bool zig_llvm_fn_key_eql(ZigLLVMFnKey const *a, ZigLLVMFnKey const *b) {
7913 if (a->id != b->id)
79107914 return false;
7911 switch (a.id) {
7915 switch (a->id) {
79127916 case ZigLLVMFnIdCtz:
7913 return a.data.ctz.bit_count == b.data.ctz.bit_count;
7917 return a->data.ctz.bit_count == b->data.ctz.bit_count;
79147918 case ZigLLVMFnIdClz:
7915 return a.data.clz.bit_count == b.data.clz.bit_count;
7919 return a->data.clz.bit_count == b->data.clz.bit_count;
79167920 case ZigLLVMFnIdPopCount:
7917 return a.data.pop_count.bit_count == b.data.pop_count.bit_count;
7921 return a->data.pop_count.bit_count == b->data.pop_count.bit_count;
79187922 case ZigLLVMFnIdBswap:
7919 return a.data.bswap.bit_count == b.data.bswap.bit_count &&
7920 a.data.bswap.vector_len == b.data.bswap.vector_len;
7923 return a->data.bswap.bit_count == b->data.bswap.bit_count &&
7924 a->data.bswap.vector_len == b->data.bswap.vector_len;
79217925 case ZigLLVMFnIdBitReverse:
7922 return a.data.bit_reverse.bit_count == b.data.bit_reverse.bit_count;
7926 return a->data.bit_reverse.bit_count == b->data.bit_reverse.bit_count;
79237927 case ZigLLVMFnIdFloatOp:
7924 return a.data.floating.bit_count == b.data.floating.bit_count &&
7925 a.data.floating.vector_len == b.data.floating.vector_len &&
7926 a.data.floating.op == b.data.floating.op;
7928 return a->data.floating.bit_count == b->data.floating.bit_count &&
7929 a->data.floating.vector_len == b->data.floating.vector_len &&
7930 a->data.floating.op == b->data.floating.op;
79277931 case ZigLLVMFnIdFMA:
7928 return a.data.floating.bit_count == b.data.floating.bit_count &&
7929 a.data.floating.vector_len == b.data.floating.vector_len;
7932 return a->data.floating.bit_count == b->data.floating.bit_count &&
7933 a->data.floating.vector_len == b->data.floating.vector_len;
79307934 case ZigLLVMFnIdOverflowArithmetic:
7931 return (a.data.overflow_arithmetic.bit_count == b.data.overflow_arithmetic.bit_count) &&
7932 (a.data.overflow_arithmetic.add_sub_mul == b.data.overflow_arithmetic.add_sub_mul) &&
7933 (a.data.overflow_arithmetic.is_signed == b.data.overflow_arithmetic.is_signed) &&
7934 (a.data.overflow_arithmetic.vector_len == b.data.overflow_arithmetic.vector_len);
7935 return (a->data.overflow_arithmetic.bit_count == b->data.overflow_arithmetic.bit_count) &&
7936 (a->data.overflow_arithmetic.add_sub_mul == b->data.overflow_arithmetic.add_sub_mul) &&
7937 (a->data.overflow_arithmetic.is_signed == b->data.overflow_arithmetic.is_signed) &&
7938 (a->data.overflow_arithmetic.vector_len == b->data.overflow_arithmetic.vector_len);
79357939 }
79367940 zig_unreachable();
79377941}
src/stage1/bigint.cpp+5-5
......@@ -1730,16 +1730,16 @@ Cmp bigint_cmp_zero(const BigInt *op) {
17301730 return op->is_negative ? CmpLT : CmpGT;
17311731}
17321732
1733uint32_t bigint_hash(BigInt x) {
1734 if (x.digit_count == 0) {
1733uint32_t bigint_hash(BigInt const *x) {
1734 if (x->digit_count == 0) {
17351735 return 0;
17361736 } else {
1737 return bigint_ptr(&x)[0];
1737 return bigint_ptr(x)[0];
17381738 }
17391739}
17401740
1741bool bigint_eql(BigInt a, BigInt b) {
1742 return bigint_cmp(&a, &b) == CmpEQ;
1741bool bigint_eql(BigInt const *a, BigInt const *b) {
1742 return bigint_cmp(a, b) == CmpEQ;
17431743}
17441744
17451745void bigint_incr(BigInt *x) {
src/stage1/bigint.hpp+2-2
......@@ -100,7 +100,7 @@ void bigint_decr(BigInt *value);
100100
101101bool mul_u64_overflow(uint64_t op1, uint64_t op2, uint64_t *result);
102102
103uint32_t bigint_hash(BigInt x);
104bool bigint_eql(BigInt a, BigInt b);
103uint32_t bigint_hash(BigInt const *x);
104bool bigint_eql(BigInt const *a, BigInt const *b);
105105
106106#endif
src/stage1/hash_map.hpp+38-12
......@@ -12,7 +12,33 @@
1212
1313#include <stdint.h>
1414
15template<typename K, typename V, uint32_t (*HashFunction)(K key), bool (*EqualFn)(K a, K b)>
15template<typename K>
16struct MakePointer {
17 typedef K const *Type;
18 static Type convert(K const &val) {
19 return &val;
20 }
21};
22
23template<typename K>
24struct MakePointer<K*> {
25 typedef K *Type;
26 static Type convert(K * const &val) {
27 return val;
28 }
29};
30
31template<typename K>
32struct MakePointer<K const *> {
33 typedef K const *Type;
34 static Type convert(K const * const &val) {
35 return val;
36 }
37};
38
39template<typename K, typename V,
40 uint32_t (*HashFunction)(typename MakePointer<K>::Type key),
41 bool (*EqualFn)(typename MakePointer<K>::Type a, typename MakePointer<K>::Type b)>
1642class HashMap {
1743public:
1844 void init(int capacity) {
......@@ -51,7 +77,7 @@ public:
5177
5278 if (_index_bytes == nullptr) {
5379 if (_entries.length < 16) {
54 _entries.append({HashFunction(key), 0, key, value});
80 _entries.append({HashFunction(MakePointer<K>::convert(key)), 0, key, value});
5581 return;
5682 } else {
5783 _indexes_len = 32;
......@@ -131,9 +157,9 @@ public:
131157 bool maybe_remove(const K &key) {
132158 _modification_count += 1;
133159 if (_index_bytes == nullptr) {
134 uint32_t hash = HashFunction(key);
160 uint32_t hash = HashFunction(MakePointer<K>::convert(key));
135161 for (size_t i = 0; i < _entries.length; i += 1) {
136 if (_entries.items[i].hash == hash && EqualFn(_entries.items[i].key, key)) {
162 if (_entries.items[i].hash == hash && EqualFn(MakePointer<K>::convert(_entries.items[i].key), MakePointer<K>::convert(key))) {
137163 _entries.swap_remove(i);
138164 return true;
139165 }
......@@ -223,7 +249,7 @@ private:
223249
224250 template <typename I>
225251 void internal_put(const K &key, const V &value, I *indexes) {
226 uint32_t hash = HashFunction(key);
252 uint32_t hash = HashFunction(MakePointer<K>::convert(key));
227253 uint32_t distance_from_start_index = 0;
228254 size_t start_index = hash_to_index(hash);
229255 for (size_t roll_over = 0; roll_over < _indexes_len;
......@@ -241,7 +267,7 @@ private:
241267 // This pointer survives the following append because we call
242268 // _entries.ensure_capacity before internal_put.
243269 Entry *entry = &_entries.items[index_data - 1];
244 if (entry->hash == hash && EqualFn(entry->key, key)) {
270 if (entry->hash == hash && EqualFn(MakePointer<K>::convert(entry->key), MakePointer<K>::convert(key))) {
245271 *entry = {hash, distance_from_start_index, key, value};
246272 if (distance_from_start_index > _max_distance_from_start_index)
247273 _max_distance_from_start_index = distance_from_start_index;
......@@ -322,9 +348,9 @@ private:
322348
323349 Entry *internal_get(const K &key) const {
324350 if (_index_bytes == nullptr) {
325 uint32_t hash = HashFunction(key);
351 uint32_t hash = HashFunction(MakePointer<K>::convert(key));
326352 for (size_t i = 0; i < _entries.length; i += 1) {
327 if (_entries.items[i].hash == hash && EqualFn(_entries.items[i].key, key)) {
353 if (_entries.items[i].hash == hash && EqualFn(MakePointer<K>::convert(_entries.items[i].key), MakePointer<K>::convert(key))) {
328354 return &_entries.items[i];
329355 }
330356 }
......@@ -340,7 +366,7 @@ private:
340366
341367 template <typename I>
342368 Entry *internal_get2(const K &key, I *indexes) const {
343 uint32_t hash = HashFunction(key);
369 uint32_t hash = HashFunction(MakePointer<K>::convert(key));
344370 size_t start_index = hash_to_index(hash);
345371 for (size_t roll_over = 0; roll_over <= _max_distance_from_start_index; roll_over += 1) {
346372 size_t index_index = (start_index + roll_over) % _indexes_len;
......@@ -349,7 +375,7 @@ private:
349375 return nullptr;
350376
351377 Entry *entry = &_entries.items[index_data - 1];
352 if (entry->hash == hash && EqualFn(entry->key, key))
378 if (entry->hash == hash && EqualFn(MakePointer<K>::convert(entry->key), MakePointer<K>::convert(key)))
353379 return entry;
354380 }
355381 return nullptr;
......@@ -361,7 +387,7 @@ private:
361387
362388 template <typename I>
363389 bool internal_remove(const K &key, I *indexes) {
364 uint32_t hash = HashFunction(key);
390 uint32_t hash = HashFunction(MakePointer<K>::convert(key));
365391 size_t start_index = hash_to_index(hash);
366392 for (size_t roll_over = 0; roll_over <= _max_distance_from_start_index; roll_over += 1) {
367393 size_t index_index = (start_index + roll_over) % _indexes_len;
......@@ -371,7 +397,7 @@ private:
371397
372398 size_t index = index_data - 1;
373399 Entry *entry = &_entries.items[index];
374 if (entry->hash != hash || !EqualFn(entry->key, key))
400 if (entry->hash != hash || !EqualFn(MakePointer<K>::convert(entry->key), MakePointer<K>::convert(key)))
375401 continue;
376402
377403 size_t prev_index = index_index;