11// Licensed under the MIT License <http://opensource.org/licenses/MIT>.
22// SPDX-License-Identifier: MIT
33// RapidFuzz v1.0.2
4- // Generated: 2024-10-24 14:07:33.184436
4+ // Generated: 2024-10-24 14:15:39.050296
55// ----------------------------------------------------------
66// This file is an amalgamation of multiple different files.
77// You probably shouldn't edit it directly.
@@ -3572,7 +3572,7 @@ struct MultiSimilarityBase : public MultiNormalizedMetricBase<T, ResType> {
35723572
35733573 template <typename Sentence2>
35743574 void distance (ResType* scores, size_t score_count, const Sentence2& s2,
3575- ResType score_cutoff = WorstDistance) const
3575+ ResType score_cutoff = static_cast <ResType>( WorstDistance) ) const
35763576 {
35773577 _distance (scores, score_count, Range (s2), score_cutoff);
35783578 }
@@ -3671,26 +3671,26 @@ size_t damerau_levenshtein_distance_zhao(const Range<InputIt1>& s1, const Range<
36713671
36723672 auto iter_s2 = s2.begin ();
36733673 for (IntType j = 1 ; j <= len2; j++) {
3674- ptrdiff_t diag = R1[j - 1 ] + static_cast <IntType>(*iter_s1 != *iter_s2);
3675- ptrdiff_t left = R[j - 1 ] + 1 ;
3676- ptrdiff_t up = R1[j] + 1 ;
3677- ptrdiff_t temp = std::min ({diag, left, up});
3674+ int64_t diag = R1[j - 1 ] + static_cast <IntType>(*iter_s1 != *iter_s2);
3675+ int64_t left = R[j - 1 ] + 1 ;
3676+ int64_t up = R1[j] + 1 ;
3677+ int64_t temp = std::min ({diag, left, up});
36783678
36793679 if (*iter_s1 == *iter_s2) {
36803680 last_col_id = j; // last occurence of s1_i
36813681 FR[j] = R1[j - 2 ]; // save H_k-1,j-2
36823682 T = last_i2l1; // save H_i-2,l-1
36833683 }
36843684 else {
3685- ptrdiff_t k = last_row_id.get (static_cast <uint64_t >(*iter_s2)).val ;
3686- ptrdiff_t l = last_col_id;
3685+ int64_t k = last_row_id.get (static_cast <uint64_t >(*iter_s2)).val ;
3686+ int64_t l = last_col_id;
36873687
36883688 if ((j - l) == 1 ) {
3689- ptrdiff_t transpose = FR[j] + (i - k);
3689+ int64_t transpose = FR[j] + (i - k);
36903690 temp = std::min (temp, transpose);
36913691 }
36923692 else if ((i - k) == 1 ) {
3693- ptrdiff_t transpose = T + (j - l);
3693+ int64_t transpose = T + (j - l);
36943694 temp = std::min (temp, transpose);
36953695 }
36963696 }
@@ -4482,7 +4482,7 @@ void lcs_simd(Range<size_t*> scores, const BlockPatternMatchVector& block, const
44824482 unroll<int , interleaveCount>([&](auto j) {
44834483 auto counts = popcount (~S[j]);
44844484 unroll<int , counts.size ()>([&](auto i) {
4485- *score_iter = (counts[i] >= score_cutoff) ? counts[i] : 0 ;
4485+ *score_iter = (counts[i] >= score_cutoff) ? static_cast < size_t >( counts[i]) : 0 ;
44864486 score_iter++;
44874487 });
44884488 });
@@ -4502,7 +4502,7 @@ void lcs_simd(Range<size_t*> scores, const BlockPatternMatchVector& block, const
45024502
45034503 auto counts = popcount (~S);
45044504 unroll<int , counts.size ()>([&](auto i) {
4505- *score_iter = (counts[i] >= score_cutoff) ? counts[i] : 0 ;
4505+ *score_iter = (counts[i] >= score_cutoff) ? static_cast < size_t >( counts[i]) : 0 ;
45064506 score_iter++;
45074507 });
45084508 }
@@ -5614,7 +5614,8 @@ static inline size_t count_transpositions_block(const BlockPatternMatchVector& P
56145614
56155615 uint64_t PatternFlagMask = blsi (P_flag);
56165616
5617- Transpositions += !(PM.get (PatternWord, T_first[countr_zero (T_flag)]) & PatternFlagMask);
5617+ Transpositions += !(PM.get (PatternWord, T_first[static_cast <ptrdiff_t >(countr_zero (T_flag))]) &
5618+ PatternFlagMask);
56185619
56195620 T_flag = blsr (T_flag);
56205621 P_flag ^= PatternFlagMask;
@@ -5823,7 +5824,7 @@ static inline auto jaro_similarity_prepare_bound_short_s2(const VecType* s1_leng
58235824
58245825 // todo try to find a simd implementation for sse2
58255826 for (size_t i = 0 ; i < vec_width; ++i) {
5826- size_t Bound = jaro_bounds (s1_lengths[i], s2.size ());
5827+ size_t Bound = jaro_bounds (static_cast < size_t >( s1_lengths[i]) , s2.size ());
58275828
58285829 if (Bound > bounds.maxBound ) bounds.maxBound = Bound;
58295830
@@ -5835,7 +5836,7 @@ static inline auto jaro_similarity_prepare_bound_short_s2(const VecType* s1_leng
58355836 bounds.boundMask = native_simd<VecType>(reinterpret_cast <uint64_t *>(boundMask_.data ()));
58365837# endif
58375838
5838- size_t lastRelevantChar = maxLen + bounds.maxBound ;
5839+ size_t lastRelevantChar = static_cast < size_t >( maxLen) + bounds.maxBound ;
58395840 if (s2.size () > lastRelevantChar) s2.remove_suffix (s2.size () - lastRelevantChar);
58405841
58415842 return bounds;
@@ -5865,7 +5866,7 @@ static inline auto jaro_similarity_prepare_bound_long_s2(const VecType* s1_lengt
58655866 bounds.boundMaskSize = native_simd<VecType>(bit_mask_lsb<VecType>(2 * bounds.maxBound ));
58665867 bounds.boundMask = native_simd<VecType>(bit_mask_lsb<VecType>(bounds.maxBound + 1 ));
58675868
5868- size_t lastRelevantChar = maxLen + bounds.maxBound ;
5869+ size_t lastRelevantChar = static_cast < size_t >( maxLen) + bounds.maxBound ;
58695870 if (s2.size () > lastRelevantChar) s2.remove_suffix (s2.size () - lastRelevantChar);
58705871
58715872 return bounds;
@@ -5966,8 +5967,10 @@ jaro_similarity_simd_long_s2(Range<double*> scores, const detail::BlockPatternMa
59665967 T_flag[i].store (T_flags + i * vec_width);
59675968
59685969 for (size_t i = 0 ; i < vec_width; ++i) {
5969- VecType CommonChars = counts[i];
5970- if (!jaro_common_char_filter (s1_lengths[result_index], s2.size (), CommonChars, score_cutoff)) {
5970+ size_t CommonChars = static_cast <size_t >(counts[i]);
5971+ if (!jaro_common_char_filter (static_cast <size_t >(s1_lengths[result_index]), s2.size (),
5972+ CommonChars, score_cutoff))
5973+ {
59715974 scores[result_index] = 0.0 ;
59725975 result_index++;
59735976 continue ;
@@ -6001,8 +6004,8 @@ jaro_similarity_simd_long_s2(Range<double*> scores, const detail::BlockPatternMa
60016004 }
60026005 }
60036006
6004- double Sim =
6005- jaro_calculate_similarity (s1_lengths[result_index], s2. size (), CommonChars, Transpositions);
6007+ double Sim = jaro_calculate_similarity ( static_cast < size_t >(s1_lengths[result_index]), s2. size (),
6008+ CommonChars, Transpositions);
60066009
60076010 scores[result_index] = (Sim >= score_cutoff) ? Sim : 0 ;
60086011 result_index++;
@@ -6077,8 +6080,10 @@ jaro_similarity_simd_short_s2(Range<double*> scores, const detail::BlockPatternM
60776080 alignas (alignment) std::array<VecType, vec_width> T_flags;
60786081 T_flag.store (T_flags.data ());
60796082 for (size_t i = 0 ; i < vec_width; ++i) {
6080- VecType CommonChars = counts[i];
6081- if (!jaro_common_char_filter (s1_lengths[result_index], s2.size (), CommonChars, score_cutoff)) {
6083+ size_t CommonChars = static_cast <size_t >(counts[i]);
6084+ if (!jaro_common_char_filter (static_cast <size_t >(s1_lengths[result_index]), s2.size (),
6085+ CommonChars, score_cutoff))
6086+ {
60826087 scores[result_index] = 0.0 ;
60836088 result_index++;
60846089 continue ;
@@ -6101,8 +6106,8 @@ jaro_similarity_simd_short_s2(Range<double*> scores, const detail::BlockPatternM
61016106 P_flag_cur ^= PatternFlagMask;
61026107 }
61036108
6104- double Sim =
6105- jaro_calculate_similarity (s1_lengths[result_index], s2. size (), CommonChars, Transpositions);
6109+ double Sim = jaro_calculate_similarity ( static_cast < size_t >(s1_lengths[result_index]), s2. size (),
6110+ CommonChars, Transpositions);
61066111
61076112 scores[result_index] = (Sim >= score_cutoff) ? Sim : 0 ;
61086113 result_index++;
@@ -7391,7 +7396,8 @@ auto levenshtein_hyrroe2003_block(const BlockPatternMatchVector& PM, const Range
73917396 vecs[last_block].VN = 0 ;
73927397
73937398 size_t chars_in_block = (last_block + 1 == words) ? ((s1.size () - 1 ) % word_size + 1 ) : 64 ;
7394- scores[last_block] = scores[last_block - 1 ] + chars_in_block - HP_carry + HN_carry;
7399+ scores[last_block] = scores[last_block - 1 ] + chars_in_block - static_cast <size_t >(HP_carry) +
7400+ static_cast <size_t >(HN_carry);
73957401 // todo probably wrong types
73967402 scores[last_block] = static_cast <size_t >(static_cast <ptrdiff_t >(scores[last_block]) +
73977403 advance_block (last_block));
0 commit comments