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-31 10:37:34.774579
4+ // Generated: 2023-10-31 11:09:46.332642
55// ----------------------------------------------------------
66// This file is an amalgamation of multiple different files.
77// You probably shouldn't edit it directly.
@@ -5717,7 +5717,7 @@ static inline auto jaro_similarity_prepare_bound_short_s2(const VecType* s1_leng
57175717
57185718 static constexpr size_t alignment = native_simd<VecType>::alignment;
57195719 static constexpr size_t vec_width = native_simd<VecType>::size;
5720- assert (static_cast <size_t >(s2.size ()) > sizeof (VecType) * 8 );
5720+ assert (static_cast <size_t >(s2.size ()) <= sizeof (VecType) * 8 );
57215721
57225722 JaroSimilaritySimdBounds<native_simd<VecType>> bounds;
57235723
@@ -5769,7 +5769,7 @@ static inline auto jaro_similarity_prepare_bound_short_s2(const VecType* s1_leng
57695769 bounds.boundMask = native_simd<VecType>(reinterpret_cast <uint64_t *>(boundMask_.data ()));
57705770# endif
57715771
5772- int64_t lastRelevantChar = maxLen + bounds.maxBound ;
5772+ int64_t lastRelevantChar = static_cast < int64_t >( maxLen) + bounds.maxBound ;
57735773 if (s2.size () > lastRelevantChar) s2.remove_suffix (s2.size () - lastRelevantChar);
57745774
57755775 return bounds;
@@ -5784,7 +5784,6 @@ static inline auto jaro_similarity_prepare_bound_long_s2(const VecType* s1_lengt
57845784 using namespace simd_sse2 ;
57855785# endif
57865786
5787- static constexpr size_t alignment = native_simd<VecType>::alignment;
57885787 static constexpr size_t vec_width = native_simd<VecType>::size;
57895788 assert (static_cast <size_t >(s2.size ()) > sizeof (VecType) * 8 );
57905789
@@ -5800,17 +5799,16 @@ static inline auto jaro_similarity_prepare_bound_long_s2(const VecType* s1_lengt
58005799 bounds.boundMaskSize = native_simd<VecType>(bit_mask_lsb<VecType>(static_cast <int >(2 * bounds.maxBound )));
58015800 bounds.boundMask = native_simd<VecType>(bit_mask_lsb<VecType>(static_cast <int >(bounds.maxBound + 1 )));
58025801
5803- int64_t lastRelevantChar = maxLen + bounds.maxBound ;
5802+ int64_t lastRelevantChar = static_cast < int64_t >( maxLen) + bounds.maxBound ;
58045803 if (s2.size () > lastRelevantChar) s2.remove_suffix (s2.size () - lastRelevantChar);
58055804
58065805 return bounds;
58075806}
58085807
58095808template <typename VecType, typename InputIt, int _lto_hack = RAPIDFUZZ_LTO_HACK>
5810- static inline void jaro_similarity_simd_long_s2 (Range<double *> scores,
5811- const detail::BlockPatternMatchVector& block,
5812- VecType* s1_lengths, size_t s1_lengths_size,
5813- Range<InputIt> s2, double score_cutoff) noexcept
5809+ static inline void
5810+ jaro_similarity_simd_long_s2 (Range<double *> scores, const detail::BlockPatternMatchVector& block,
5811+ VecType* s1_lengths, Range<InputIt> s2, double score_cutoff) noexcept
58145812{
58155813# ifdef RAPIDFUZZ_AVX2
58165814 using namespace simd_avx2 ;
@@ -5828,14 +5826,15 @@ static inline void jaro_similarity_simd_long_s2(Range<double*> scores,
58285826 native_simd<VecType> one (1 );
58295827 size_t result_index = 0 ;
58305828
5829+ size_t s2_block_count = static_cast <size_t >(detail::ceil_div (s2.size (), sizeof (VecType) * 8 ));
58315830 std::vector<native_simd<VecType>> T_flag;
5832- T_flag.resize (detail::ceil_div (s2. size (), sizeof (VecType) * 8 ) );
5831+ T_flag.resize (s2_block_count );
58335832
58345833 std::vector<native_simd<VecType>> counter;
5835- counter.resize (detail::ceil_div (s2. size (), sizeof (VecType) * 8 ) );
5834+ counter.resize (s2_block_count );
58365835
58375836 std::vector<std::array<VecType, vec_width>> T_flags;
5838- T_flags.resize (detail::ceil_div (s2. size (), sizeof (VecType) * 8 ) );
5837+ T_flags.resize (s2_block_count );
58395838
58405839 for (size_t cur_vec = 0 ; cur_vec < block.size (); cur_vec += vecs) {
58415840 auto s2_cur = s2;
@@ -5861,7 +5860,7 @@ static inline void jaro_similarity_simd_long_s2(Range<double*> scores,
58615860 native_simd<VecType> PM_j = andnot (X & bounds.boundMask , P_flag);
58625861
58635862 P_flag |= blsi (PM_j);
5864- auto T_word_index = j / (sizeof (VecType) * 8 );
5863+ size_t T_word_index = static_cast < size_t >(j) / (sizeof (VecType) * 8 );
58655864 T_flag[T_word_index] |= andnot (counter[T_word_index], (PM_j == zero));
58665865
58675866 counter[T_word_index] = counter[T_word_index] << 1 ;
@@ -5875,7 +5874,7 @@ static inline void jaro_similarity_simd_long_s2(Range<double*> scores,
58755874 native_simd<VecType> PM_j = andnot (X & bounds.boundMask , P_flag);
58765875
58775876 P_flag |= blsi (PM_j);
5878- auto T_word_index = j / (sizeof (VecType) * 8 );
5877+ size_t T_word_index = static_cast < size_t >(j) / (sizeof (VecType) * 8 );
58795878 T_flag[T_word_index] |= andnot (counter[T_word_index], (PM_j == zero));
58805879
58815880 counter[T_word_index] = counter[T_word_index] << 1 ;
@@ -5886,7 +5885,8 @@ static inline void jaro_similarity_simd_long_s2(Range<double*> scores,
58865885 alignas (alignment) std::array<VecType, vec_width> P_flags;
58875886 P_flag.store (P_flags.data ());
58885887
5889- for (size_t i = 0 ; i < detail::ceil_div (s2_cur.size (), sizeof (VecType) * 8 ); ++i) {
5888+ for (size_t i = 0 ; i < static_cast <size_t >(detail::ceil_div (s2_cur.size (), sizeof (VecType) * 8 )); ++i)
5889+ {
58905890 alignas (alignment) std::array<VecType, vec_width> T_flags_;
58915891 T_flag[i].store (T_flags_.data ());
58925892 T_flags[i] = T_flags_;
@@ -5920,8 +5920,9 @@ static inline void jaro_similarity_simd_long_s2(Range<double*> scores,
59205920
59215921 VecType PatternFlagMask = blsi (P_flag_cur);
59225922
5923- uint64_t PM_j = block.get (
5924- cur_block, s2[countr_zero (T_flag_cur) + T_word_index * sizeof (VecType) * 8 ]);
5923+ uint64_t PM_j =
5924+ block.get (cur_block, s2[countr_zero (T_flag_cur) +
5925+ static_cast <ptrdiff_t >(T_word_index * sizeof (VecType) * 8 )]);
59255926 Transpositions += !(PM_j & (static_cast <uint64_t >(PatternFlagMask) << offset));
59265927
59275928 T_flag_cur = blsr (T_flag_cur);
@@ -5939,10 +5940,9 @@ static inline void jaro_similarity_simd_long_s2(Range<double*> scores,
59395940}
59405941
59415942template <typename VecType, typename InputIt, int _lto_hack = RAPIDFUZZ_LTO_HACK>
5942- static inline void jaro_similarity_simd_short_s2 (Range<double *> scores,
5943- const detail::BlockPatternMatchVector& block,
5944- VecType* s1_lengths, size_t s1_lengths_size,
5945- Range<InputIt> s2, double score_cutoff) noexcept
5943+ static inline void
5944+ jaro_similarity_simd_short_s2 (Range<double *> scores, const detail::BlockPatternMatchVector& block,
5945+ VecType* s1_lengths, Range<InputIt> s2, double score_cutoff) noexcept
59465946{
59475947# ifdef RAPIDFUZZ_AVX2
59485948 using namespace simd_avx2 ;
@@ -6061,9 +6061,9 @@ static inline void jaro_similarity_simd(Range<double*> scores, const detail::Blo
60616061 }
60626062
60636063 if (static_cast <size_t >(s2.size ()) > sizeof (VecType) * 8 )
6064- return jaro_similarity_simd_long_s2 (scores, block, s1_lengths, s1_lengths_size, s2, score_cutoff);
6064+ return jaro_similarity_simd_long_s2 (scores, block, s1_lengths, s2, score_cutoff);
60656065 else
6066- return jaro_similarity_simd_short_s2 (scores, block, s1_lengths, s1_lengths_size, s2, score_cutoff);
6066+ return jaro_similarity_simd_short_s2 (scores, block, s1_lengths, s2, score_cutoff);
60676067}
60686068
60696069#endif /* RAPIDFUZZ_SIMD */
0 commit comments