11// Licensed under the MIT License <http://opensource.org/licenses/MIT>.
22// SPDX-License-Identifier: MIT
33// RapidFuzz v1.0.2
4- // Generated: 2023-12-25 15:26:08.006867
4+ // Generated: 2023-12-25 16:08:55.279788
55// ----------------------------------------------------------
66// This file is an amalgamation of multiple different files.
77// You probably shouldn't edit it directly.
@@ -4593,7 +4593,7 @@ auto lcs_blockwise(const PMV& PM, const Range<InputIt1>& s1, const Range<InputIt
45934593 for (size_t row = 0 ; row < s2.size (); ++row) {
45944594 uint64_t carry = 0 ;
45954595
4596- if constexpr (RecordMatrix) res.S .set_offset (row, static_cast <ssize_t >(first_block * word_size));
4596+ if constexpr (RecordMatrix) res.S .set_offset (row, static_cast <ptrdiff_t >(first_block * word_size));
45974597
45984598 for (size_t word = first_block; word < last_block; ++word) {
45994599 const uint64_t Matches = PM .get (word, *iter_s2);
@@ -4753,8 +4753,8 @@ Editops recover_alignment(const Range<InputIt1>& s1, const Range<InputIt2>& s2,
47534753 /* Deletion */
47544754 if (matrix.S .test_bit (row - 1 , col - 1 )) {
47554755 assert (dist > 0 );
4756- assert (static_cast <ssize_t >(col) >=
4757- static_cast <ssize_t >(row) - static_cast <ssize_t >(band_width_right));
4756+ assert (static_cast <ptrdiff_t >(col) >=
4757+ static_cast <ptrdiff_t >(row) - static_cast <ptrdiff_t >(band_width_right));
47584758 dist--;
47594759 col--;
47604760 editops[dist].type = EditType::Delete;
@@ -7051,7 +7051,7 @@ size_t levenshtein_hyrroe2003_small_band(const BlockPatternMatchVector& PM, cons
70517051 size_t currDist = max;
70527052 uint64_t diagonal_mask = UINT64_C (1 ) << 63 ;
70537053 uint64_t horizontal_mask = UINT64_C (1 ) << 62 ;
7054- ssize_t start_pos = static_cast <ssize_t >(max) + 1 - 64 ;
7054+ ptrdiff_t start_pos = static_cast <ptrdiff_t >(max) + 1 - 64 ;
70557055
70567056 /* score can decrease along the horizontal, but not along the diagonal */
70577057 size_t break_score = 2 * max + s2.size () - s1.size ();
@@ -7145,10 +7145,10 @@ auto levenshtein_hyrroe2003_small_band(const Range<InputIt1>& s1, const Range<In
71457145 res.VP = ShiftedBitMatrix<uint64_t >(s2.size (), 1 , ~UINT64_C (0 ));
71467146 res.VN = ShiftedBitMatrix<uint64_t >(s2.size (), 1 , 0 );
71477147
7148- ssize_t start_offset = static_cast <ssize_t >(max) + 2 - 64 ;
7148+ ptrdiff_t start_offset = static_cast <ptrdiff_t >(max) + 2 - 64 ;
71497149 for (size_t i = 0 ; i < s2.size (); ++i) {
7150- res.VP .set_offset (i, start_offset + static_cast <ssize_t >(i));
7151- res.VN .set_offset (i, start_offset + static_cast <ssize_t >(i));
7150+ res.VP .set_offset (i, start_offset + static_cast <ptrdiff_t >(i));
7151+ res.VN .set_offset (i, start_offset + static_cast <ptrdiff_t >(i));
71527152 }
71537153 }
71547154
@@ -7157,10 +7157,10 @@ auto levenshtein_hyrroe2003_small_band(const Range<InputIt1>& s1, const Range<In
71577157
71587158 /* score can decrease along the horizontal, but not along the diagonal */
71597159 size_t break_score = 2 * max + s2.size () - (s1.size ());
7160- HybridGrowingHashmap<typename Range<InputIt1>::value_type, std::pair<ssize_t , uint64_t >> PM ;
7160+ HybridGrowingHashmap<typename Range<InputIt1>::value_type, std::pair<ptrdiff_t , uint64_t >> PM ;
71617161
71627162 auto iter_s1 = s1.begin ();
7163- for (ssize_t j = -static_cast <ssize_t >(max); j < 0 ; ++iter_s1, ++j) {
7163+ for (ptrdiff_t j = -static_cast <ptrdiff_t >(max); j < 0 ; ++iter_s1, ++j) {
71647164 auto & x = PM [*iter_s1];
71657165 x.second = shr64 (x.second , j - x.first ) | (UINT64_C (1 ) << 63 );
71667166 x.first = j;
@@ -7175,12 +7175,12 @@ auto levenshtein_hyrroe2003_small_band(const Range<InputIt1>& s1, const Range<In
71757175 uint64_t PM_j = 0 ;
71767176 {
71777177 auto & x = PM [*iter_s1];
7178- x.second = shr64 (x.second , static_cast <ssize_t >(i) - x.first ) | (UINT64_C (1 ) << 63 );
7179- x.first = static_cast <ssize_t >(i);
7178+ x.second = shr64 (x.second , static_cast <ptrdiff_t >(i) - x.first ) | (UINT64_C (1 ) << 63 );
7179+ x.first = static_cast <ptrdiff_t >(i);
71807180 }
71817181 {
71827182 auto x = PM .get (*iter_s2);
7183- PM_j = shr64 (x.second , static_cast <ssize_t >(i) - x.first );
7183+ PM_j = shr64 (x.second , static_cast <ptrdiff_t >(i) - x.first );
71847184 }
71857185
71867186 uint64_t X = PM_j;
@@ -7214,13 +7214,13 @@ auto levenshtein_hyrroe2003_small_band(const Range<InputIt1>& s1, const Range<In
72147214 uint64_t PM_j = 0 ;
72157215 if (iter_s1 != s1.end ()) {
72167216 auto & x = PM [*iter_s1];
7217- x.second = shr64 (x.second , static_cast <ssize_t >(i) - x.first ) | (UINT64_C (1 ) << 63 );
7218- x.first = static_cast <ssize_t >(i);
7217+ x.second = shr64 (x.second , static_cast <ptrdiff_t >(i) - x.first ) | (UINT64_C (1 ) << 63 );
7218+ x.first = static_cast <ptrdiff_t >(i);
72197219 ++iter_s1;
72207220 }
72217221 {
72227222 auto x = PM .get (*iter_s2);
7223- PM_j = shr64 (x.second , static_cast <ssize_t >(i) - x.first );
7223+ PM_j = shr64 (x.second , static_cast <ptrdiff_t >(i) - x.first );
72247224 }
72257225
72267226 uint64_t X = PM_j;
@@ -7309,8 +7309,8 @@ auto levenshtein_hyrroe2003_block(const BlockPatternMatchVector& PM, const Range
73097309 uint64_t HN_carry = 0 ;
73107310
73117311 if constexpr (RecordMatrix) {
7312- res.VP .set_offset (row, static_cast <ssize_t >(first_block * word_size));
7313- res.VN .set_offset (row, static_cast <ssize_t >(first_block * word_size));
7312+ res.VP .set_offset (row, static_cast <ptrdiff_t >(first_block * word_size));
7313+ res.VN .set_offset (row, static_cast <ptrdiff_t >(first_block * word_size));
73147314 }
73157315
73167316 auto advance_block = [&](size_t word) {
@@ -7359,14 +7359,14 @@ auto levenshtein_hyrroe2003_block(const BlockPatternMatchVector& PM, const Range
73597359
73607360 for (size_t word = first_block; word <= last_block /* - 1*/ ; word++) {
73617361 /* Step 3: Computing the value D[m,j] */
7362- scores[word] = static_cast <size_t >(static_cast <ssize_t >(scores[word]) + advance_block (word));
7362+ scores[word] = static_cast <size_t >(static_cast <ptrdiff_t >(scores[word]) + advance_block (word));
73637363 }
73647364
73657365 max = static_cast <size_t >(
7366- std::min (static_cast <ssize_t >(max),
7367- static_cast <ssize_t >(scores[last_block]) +
7368- std::max (static_cast <ssize_t >(s2.size ()) - static_cast <ssize_t >(row) - 1 ,
7369- static_cast <ssize_t >(s1.size ()) -
7366+ std::min (static_cast <ptrdiff_t >(max),
7367+ static_cast <ptrdiff_t >(scores[last_block]) +
7368+ std::max (static_cast <ptrdiff_t >(s2.size ()) - static_cast <ptrdiff_t >(row) - 1 ,
7369+ static_cast <ptrdiff_t >(s1.size ()) -
73707370 (static_cast <ptrdiff_t >((1 + last_block) * word_size - 1 ) - 1 ))));
73717371
73727372 /* ---------- Adjust number of blocks according to Ukkonen ----------*/
@@ -7376,9 +7376,9 @@ auto levenshtein_hyrroe2003_block(const BlockPatternMatchVector& PM, const Range
73767376 /* If block is not beneath band, calculate next block. Only next because others are certainly beneath
73777377 * band. */
73787378 if (last_block + 1 < words) {
7379- ssize_t cond = static_cast <ssize_t >(max + 2 * word_size + row + s1.size ()) -
7380- static_cast <ssize_t >(scores[last_block] + 2 + s2.size ());
7381- if (static_cast <ssize_t >(get_row_num (last_block)) < cond) {
7379+ ptrdiff_t cond = static_cast <ptrdiff_t >(max + 2 * word_size + row + s1.size ()) -
7380+ static_cast <ptrdiff_t >(scores[last_block] + 2 + s2.size ());
7381+ if (static_cast <ptrdiff_t >(get_row_num (last_block)) < cond) {
73827382 last_block++;
73837383 vecs[last_block].VP = ~UINT64_C (0 );
73847384 vecs[last_block].VN = 0 ;
@@ -7387,8 +7387,8 @@ auto levenshtein_hyrroe2003_block(const BlockPatternMatchVector& PM, const Range
73877387 scores[last_block] = scores[last_block - 1 ] + chars_in_block - static_cast <size_t >(HP_carry) +
73887388 static_cast <size_t >(HN_carry);
73897389 // todo probably wrong types
7390- scores[last_block] =
7391- static_cast < size_t >( static_cast < ssize_t >(scores[last_block]) + advance_block (last_block));
7390+ scores[last_block] = static_cast < size_t >( static_cast < ptrdiff_t >(scores[last_block]) +
7391+ advance_block (last_block));
73927392 }
73937393 }
73947394
@@ -7403,9 +7403,9 @@ auto levenshtein_hyrroe2003_block(const BlockPatternMatchVector& PM, const Range
74037403 * this uses a more loose condition similar to edlib:
74047404 * https://github.com/Martinsos/edlib
74057405 */
7406- ssize_t cond = static_cast <ssize_t >(max + 2 * word_size + row + s1.size () + 1 ) -
7407- static_cast <ssize_t >(scores[last_block] + 2 + s2.size ());
7408- bool in_band_cond2 = static_cast <ssize_t >(get_row_num (last_block)) <= cond;
7406+ ptrdiff_t cond = static_cast <ptrdiff_t >(max + 2 * word_size + row + s1.size () + 1 ) -
7407+ static_cast <ptrdiff_t >(scores[last_block] + 2 + s2.size ());
7408+ bool in_band_cond2 = static_cast <ptrdiff_t >(get_row_num (last_block)) <= cond;
74097409
74107410 if (in_band_cond1 && in_band_cond2) break ;
74117411 }
@@ -7419,9 +7419,9 @@ auto levenshtein_hyrroe2003_block(const BlockPatternMatchVector& PM, const Range
74197419 * if this condition is met for the last cell in the block, it
74207420 * is met for all other cells in the blocks as well
74217421 */
7422- ssize_t cond = static_cast <ssize_t >(scores[first_block] + s1.size () + row) -
7423- static_cast <ssize_t >(max + s2.size ());
7424- bool in_band_cond2 = static_cast <ssize_t >(get_row_num (first_block)) >= cond;
7422+ ptrdiff_t cond = static_cast <ptrdiff_t >(scores[first_block] + s1.size () + row) -
7423+ static_cast <ptrdiff_t >(max + s2.size ());
7424+ bool in_band_cond2 = static_cast <ptrdiff_t >(get_row_num (first_block)) >= cond;
74257425
74267426 if (in_band_cond1 && in_band_cond2) break ;
74277427 }
@@ -10194,10 +10194,10 @@ partial_ratio_impl(const detail::Range<InputIt1>& s1, const detail::Range<InputI
1019410194 /* find the minimum score possible in the range first <-> last */
1019510195 size_t known_edits = detail::abs_diff (scores[window.first ], scores[window.second ]);
1019610196 /* half of the cells that are not needed for known_edits can lead to a better score */
10197- ssize_t min_score =
10198- static_cast <ssize_t >(std::min (scores[window.first ], scores[window.second ])) -
10199- static_cast <ssize_t >(cell_diff + known_edits / 2 );
10200- if (min_score < static_cast <ssize_t >(cutoff_dist)) {
10197+ ptrdiff_t min_score =
10198+ static_cast <ptrdiff_t >(std::min (scores[window.first ], scores[window.second ])) -
10199+ static_cast <ptrdiff_t >(cell_diff + known_edits / 2 );
10200+ if (min_score < static_cast <ptrdiff_t >(cutoff_dist)) {
1020110201 size_t center = cell_diff / 2 ;
1020210202 new_windows.emplace_back (window.first , window.first + center);
1020310203 new_windows.emplace_back (window.first + center, window.second );
0 commit comments