@@ -83,21 +83,11 @@ static DN_FORCEINLINE(dn_simdhash_suffixes)
83
83
build_search_vector (uint8_t needle )
84
84
{
85
85
dn_simdhash_suffixes result ;
86
- // this produces a splat and then .const, .and in wasm, and the other architectures are fine too
86
+ // this produces a splat in wasm, and the other architectures are fine too
87
87
dn_u8x16 needles = {
88
88
needle , needle , needle , needle , needle , needle , needle , needle ,
89
89
needle , needle , needle , needle , needle , needle , needle , needle
90
90
};
91
- /*
92
- // TODO: Evaluate whether the & mask is actually worth it. In the C# prototype, it wasn't.
93
- // Not doing it means there is a ~1% chance of a false positive in the data bytes near the
94
- // end of the bucket, but we check the index against the bucket count anyway, so...
95
- dn_u8x16 mask = {
96
- 0xFFu, 0xFFu, 0xFFu, 0xFFu, 0xFFu, 0xFFu, 0xFFu, 0xFFu,
97
- 0xFFu, 0xFFu, 0xFFu, 0xFFu, 0xFFu, 0xFFu, 0x00u, 0x00u
98
- };
99
- result.vec = needles & mask;
100
- */
101
91
result .vec = needles ;
102
92
return result ;
103
93
}
@@ -169,9 +159,7 @@ build_search_vector (uint8_t needle)
169
159
static DN_FORCEINLINE (uint32_t )
170
160
find_first_matching_suffix (dn_simdhash_suffixes needle , dn_simdhash_suffixes haystack , uint32_t count )
171
161
{
172
- // FIXME: Completely untested.
173
- __m128i match_vector = _mm_cmpeq_epi8 (needle .m128 , haystack .m128 );
174
- return ctz (_mm_movemask_epi8 (match_vector ));
162
+ return ctz (_mm_movemask_epi8 (_mm_cmpeq_epi8 (needle .m128 , haystack .m128 )));
175
163
}
176
164
177
165
#else // unknown compiler and/or unknown non-simd arch
0 commit comments