11// Licensed under the MIT License <http://opensource.org/licenses/MIT>.
22// SPDX-License-Identifier: MIT
33// RapidFuzz v1.0.2
4- // Generated: 2023-10-08 19:49:45.137761
4+ // Generated: 2023-10-08 21:27:21.591281
55// ----------------------------------------------------------
66// This file is an amalgamation of multiple different files.
77// You probably shouldn't edit it directly.
@@ -5632,9 +5632,15 @@ void jaro_similarity_simd(Range<double*> scores, const detail::BlockPatternMatch
56325632
56335633 native_simd<VecType> counter (VecType (1 ));
56345634
5635- for (const auto & ch : s2_cur) {
5635+ // In case s2 is longer than all of the elements in s1_lengths boundMaskSize
5636+ // might have all bits set and therefor the condition ((boundMask <= boundMaskSize) & one)
5637+ // would incorrectly always set the first bit to 1.
5638+ // this is solved by splitting the loop into two parts where after this boundary is reached
5639+ // the first bit inside boundMask is no longer set
5640+ int64_t j = 0 ;
5641+ for (; j < maxBound; ++j) {
56365642 alignas (32 ) std::array<uint64_t , vecs> stored;
5637- unroll<int , vecs>([&](auto i) { stored[i] = block.get (cur_vec + i, ch ); });
5643+ unroll<int , vecs>([&](auto i) { stored[i] = block.get (cur_vec + i, s2_cur[j] ); });
56385644 native_simd<VecType> X (stored.data ());
56395645 native_simd<VecType> PM_j = andnot (X & boundMask, P_flag);
56405646
@@ -5645,6 +5651,19 @@ void jaro_similarity_simd(Range<double*> scores, const detail::BlockPatternMatch
56455651 boundMask = (boundMask << 1 ) | ((boundMask <= boundMaskSize) & one);
56465652 }
56475653
5654+ for (; j < s2_cur.size (); ++j) {
5655+ alignas (32 ) std::array<uint64_t , vecs> stored;
5656+ unroll<int , vecs>([&](auto i) { stored[i] = block.get (cur_vec + i, s2_cur[j]); });
5657+ native_simd<VecType> X (stored.data ());
5658+ native_simd<VecType> PM_j = andnot (X & boundMask, P_flag);
5659+
5660+ P_flag |= blsi (PM_j);
5661+ T_flag |= andnot (counter, (PM_j == zero));
5662+
5663+ counter = counter << 1 ;
5664+ boundMask = boundMask << 1 ;
5665+ }
5666+
56485667 auto counts = popcount (P_flag);
56495668 alignas (32 ) std::array<VecType, vec_width> P_flags;
56505669 P_flag.store (P_flags.data ());
0 commit comments