1
1
// Licensed under the MIT License <http://opensource.org/licenses/MIT>.
2
2
// SPDX-License-Identifier: MIT
3
3
// RapidFuzz v1.0.2
4
- // Generated: 2024-12-25 01:42:39.581315
4
+ // Generated: 2024-12-25 02: 01:10.995282
5
5
// ----------------------------------------------------------
6
6
// This file is an amalgamation of multiple different files.
7
7
// You probably shouldn't edit it directly.
@@ -592,7 +592,9 @@ Range(T& x) -> Range<decltype(to_begin(x))>;
592
592
template <typename InputIt1, typename InputIt2>
593
593
inline bool operator ==(const Range<InputIt1>& a, const Range<InputIt2>& b)
594
594
{
595
- return std::equal (a.begin (), a.end (), b.begin (), b.end ());
595
+ if (a.size () != b.size ()) return false ;
596
+
597
+ return std::equal (a.begin (), a.end (), b.begin ());
596
598
}
597
599
598
600
template <typename InputIt1, typename InputIt2>
@@ -978,13 +980,10 @@ class Editops : private std::vector<EditOp> {
978
980
979
981
inline bool operator ==(const Editops& lhs, const Editops& rhs)
980
982
{
981
- if (lhs.get_src_len () != rhs.get_src_len () || lhs.get_dest_len () != rhs.get_dest_len ()) {
982
- return false ;
983
- }
983
+ if (lhs.get_src_len () != rhs.get_src_len () || lhs.get_dest_len () != rhs.get_dest_len ()) return false ;
984
+
985
+ if (lhs. size () != rhs. size ()) return false ;
984
986
985
- if (lhs.size () != rhs.size ()) {
986
- return false ;
987
- }
988
987
return std::equal (lhs.begin (), lhs.end (), rhs.begin ());
989
988
}
990
989
@@ -1583,7 +1582,7 @@ struct UnrollImpl<T, N, Pos, true> {
1583
1582
{}
1584
1583
};
1585
1584
1586
- template <typename T, int N, class F >
1585
+ template <typename T, T N, class F >
1587
1586
constexpr void unroll (F&& f)
1588
1587
{
1589
1588
UnrollImpl<T, N>::call (f);
@@ -4557,22 +4556,22 @@ void lcs_simd(Range<size_t*> scores, const BlockPatternMatchVector& block, const
4557
4556
size_t cur_vec = 0 ;
4558
4557
for (; cur_vec + interleaveCount * vecs <= block.size (); cur_vec += interleaveCount * vecs) {
4559
4558
std::array<native_simd<VecType>, interleaveCount> S;
4560
- unroll<int , interleaveCount>([&](auto j) { S[j] = static_cast <VecType>(-1 ); });
4559
+ unroll<size_t , interleaveCount>([&](auto j) { S[j] = static_cast <VecType>(-1 ); });
4561
4560
4562
4561
for (const auto & ch : s2) {
4563
- unroll<int , interleaveCount>([&](auto j) {
4562
+ unroll<size_t , interleaveCount>([&](auto j) {
4564
4563
alignas (32 ) std::array<uint64_t , vecs> stored;
4565
- unroll<int , vecs>([&](auto i) { stored[i] = block.get (cur_vec + j * vecs + i, ch); });
4564
+ unroll<size_t , vecs>([&](auto i) { stored[i] = block.get (cur_vec + j * vecs + i, ch); });
4566
4565
4567
4566
native_simd<VecType> Matches (stored.data ());
4568
4567
native_simd<VecType> u = S[j] & Matches;
4569
4568
S[j] = (S[j] + u) | (S[j] - u);
4570
4569
});
4571
4570
}
4572
4571
4573
- unroll<int , interleaveCount>([&](auto j) {
4572
+ unroll<size_t , interleaveCount>([&](auto j) {
4574
4573
auto counts = popcount (~S[j]);
4575
- unroll<int , counts.size ()>([&](auto i) {
4574
+ unroll<size_t , counts.size ()>([&](auto i) {
4576
4575
*score_iter = (counts[i] >= score_cutoff) ? static_cast <size_t >(counts[i]) : 0 ;
4577
4576
score_iter++;
4578
4577
});
@@ -4584,15 +4583,15 @@ void lcs_simd(Range<size_t*> scores, const BlockPatternMatchVector& block, const
4584
4583
4585
4584
for (const auto & ch : s2) {
4586
4585
alignas (alignment) std::array<uint64_t , vecs> stored;
4587
- unroll<int , vecs>([&](auto i) { stored[i] = block.get (cur_vec + i, ch); });
4586
+ unroll<size_t , vecs>([&](auto i) { stored[i] = block.get (cur_vec + i, ch); });
4588
4587
4589
4588
native_simd<VecType> Matches (stored.data ());
4590
4589
native_simd<VecType> u = S & Matches;
4591
4590
S = (S + u) | (S - u);
4592
4591
}
4593
4592
4594
4593
auto counts = popcount (~S);
4595
- unroll<int , counts.size ()>([&](auto i) {
4594
+ unroll<size_t , counts.size ()>([&](auto i) {
4596
4595
*score_iter = (counts[i] >= score_cutoff) ? static_cast <size_t >(counts[i]) : 0 ;
4597
4596
score_iter++;
4598
4597
});
@@ -4783,8 +4782,7 @@ size_t lcs_seq_similarity(const BlockPatternMatchVector& block, Range<InputIt1>
4783
4782
size_t max_misses = len1 + len2 - 2 * score_cutoff;
4784
4783
4785
4784
/* no edits are allowed */
4786
- if (max_misses == 0 || (max_misses == 1 && len1 == len2))
4787
- return std::equal (s1.begin (), s1.end (), s2.begin (), s2.end ()) ? len1 : 0 ;
4785
+ if (max_misses == 0 || (max_misses == 1 && len1 == len2)) return s1 == s2 ? len1 : 0 ;
4788
4786
4789
4787
if (max_misses < abs_diff (len1, len2)) return 0 ;
4790
4788
@@ -4816,8 +4814,7 @@ size_t lcs_seq_similarity(Range<InputIt1> s1, Range<InputIt2> s2, size_t score_c
4816
4814
size_t max_misses = len1 + len2 - 2 * score_cutoff;
4817
4815
4818
4816
/* no edits are allowed */
4819
- if (max_misses == 0 || (max_misses == 1 && len1 == len2))
4820
- return std::equal (s1.begin (), s1.end (), s2.begin (), s2.end ()) ? len1 : 0 ;
4817
+ if (max_misses == 0 || (max_misses == 1 && len1 == len2)) return s1 == s2 ? len1 : 0 ;
4821
4818
4822
4819
if (max_misses < abs_diff (len1, len2)) return 0 ;
4823
4820
@@ -5593,7 +5590,7 @@ static inline void flag_similar_characters_step(const BlockPatternMatchVector& P
5593
5590
if (T_j >= 0 && T_j < 256 ) {
5594
5591
for (; word + 3 < last_word - 1 ; word += 4 ) {
5595
5592
uint64_t PM_j[4 ];
5596
- unroll<int , 4 >([&](auto i) {
5593
+ unroll<size_t , 4 >([&](auto i) {
5597
5594
PM_j[i] = PM.get (word + i, static_cast <uint8_t >(T_j)) & (~flagged.P_flag [word + i]);
5598
5595
});
5599
5596
@@ -6048,7 +6045,7 @@ jaro_similarity_simd_long_s2(Range<double*> scores, const detail::BlockPatternMa
6048
6045
size_t j = 0 ;
6049
6046
for (; j < std::min (bounds.maxBound , s2_cur.size ()); ++j) {
6050
6047
alignas (alignment) std::array<uint64_t , vecs> stored;
6051
- unroll<int , vecs>([&](auto i) { stored[i] = block.get (cur_vec + i, s2_cur[j]); });
6048
+ unroll<size_t , vecs>([&](auto i) { stored[i] = block.get (cur_vec + i, s2_cur[j]); });
6052
6049
native_simd<VecType> X (stored.data ());
6053
6050
native_simd<VecType> PM_j = andnot (X & bounds.boundMask , P_flag);
6054
6051
@@ -6062,7 +6059,7 @@ jaro_similarity_simd_long_s2(Range<double*> scores, const detail::BlockPatternMa
6062
6059
6063
6060
for (; j < s2_cur.size (); ++j) {
6064
6061
alignas (alignment) std::array<uint64_t , vecs> stored;
6065
- unroll<int , vecs>([&](auto i) { stored[i] = block.get (cur_vec + i, s2_cur[j]); });
6062
+ unroll<size_t , vecs>([&](auto i) { stored[i] = block.get (cur_vec + i, s2_cur[j]); });
6066
6063
native_simd<VecType> X (stored.data ());
6067
6064
native_simd<VecType> PM_j = andnot (X & bounds.boundMask , P_flag);
6068
6065
@@ -6165,7 +6162,7 @@ jaro_similarity_simd_short_s2(Range<double*> scores, const detail::BlockPatternM
6165
6162
size_t j = 0 ;
6166
6163
for (; j < std::min (bounds.maxBound , s2_cur.size ()); ++j) {
6167
6164
alignas (alignment) std::array<uint64_t , vecs> stored;
6168
- unroll<int , vecs>([&](auto i) { stored[i] = block.get (cur_vec + i, s2_cur[j]); });
6165
+ unroll<size_t , vecs>([&](auto i) { stored[i] = block.get (cur_vec + i, s2_cur[j]); });
6169
6166
native_simd<VecType> X (stored.data ());
6170
6167
native_simd<VecType> PM_j = andnot (X & bounds.boundMask , P_flag);
6171
6168
@@ -6178,7 +6175,7 @@ jaro_similarity_simd_short_s2(Range<double*> scores, const detail::BlockPatternM
6178
6175
6179
6176
for (; j < s2_cur.size (); ++j) {
6180
6177
alignas (alignment) std::array<uint64_t , vecs> stored;
6181
- unroll<int , vecs>([&](auto i) { stored[i] = block.get (cur_vec + i, s2_cur[j]); });
6178
+ unroll<size_t , vecs>([&](auto i) { stored[i] = block.get (cur_vec + i, s2_cur[j]); });
6182
6179
native_simd<VecType> X (stored.data ());
6183
6180
native_simd<VecType> PM_j = andnot (X & bounds.boundMask , P_flag);
6184
6181
@@ -7138,12 +7135,12 @@ void levenshtein_hyrroe2003_simd(Range<size_t*> scores, const detail::BlockPatte
7138
7135
native_simd<VecType> VN (VecType (0 ));
7139
7136
7140
7137
alignas (alignment) std::array<VecType, vec_width> currDist_;
7141
- unroll<int , vec_width>(
7138
+ unroll<size_t , vec_width>(
7142
7139
[&](auto i) { currDist_[i] = static_cast <VecType>(s1_lengths[result_index + i]); });
7143
7140
native_simd<VecType> currDist (reinterpret_cast <uint64_t *>(currDist_.data ()));
7144
7141
/* mask used when computing D[m,j] in the paper 10^(m-1) */
7145
7142
alignas (alignment) std::array<VecType, vec_width> mask_;
7146
- unroll<int , vec_width>([&](auto i) {
7143
+ unroll<size_t , vec_width>([&](auto i) {
7147
7144
if (s1_lengths[result_index + i] == 0 )
7148
7145
mask_[i] = 0 ;
7149
7146
else
@@ -7154,7 +7151,7 @@ void levenshtein_hyrroe2003_simd(Range<size_t*> scores, const detail::BlockPatte
7154
7151
for (const auto & ch : s2) {
7155
7152
/* Step 1: Computing D0 */
7156
7153
alignas (alignment) std::array<uint64_t , vecs> stored;
7157
- unroll<int , vecs>([&](auto i) { stored[i] = block.get (cur_vec + i, ch); });
7154
+ unroll<size_t , vecs>([&](auto i) { stored[i] = block.get (cur_vec + i, ch); });
7158
7155
7159
7156
native_simd<VecType> X (stored.data ());
7160
7157
auto D0 = (((X & VP) + VP) ^ VP) | X | VN;
@@ -7178,7 +7175,7 @@ void levenshtein_hyrroe2003_simd(Range<size_t*> scores, const detail::BlockPatte
7178
7175
alignas (alignment) std::array<VecType, vec_width> distances;
7179
7176
currDist.store (distances.data ());
7180
7177
7181
- unroll<int , vec_width>([&](auto i) {
7178
+ unroll<size_t , vec_width>([&](auto i) {
7182
7179
size_t score = 0 ;
7183
7180
/* strings of length 0 are not handled correctly */
7184
7181
if (s1_lengths[result_index] == 0 ) {
@@ -7649,7 +7646,7 @@ size_t uniform_levenshtein_distance(const BlockPatternMatchVector& block, Range<
7649
7646
if (score_hint < 31 ) score_hint = 31 ;
7650
7647
7651
7648
// when no differences are allowed a direct comparision is sufficient
7652
- if (score_cutoff == 0 ) return ! std::equal (s1. begin (), s1. end (), s2. begin (), s2. end ()) ;
7649
+ if (score_cutoff == 0 ) return s1 != s2;
7653
7650
7654
7651
if (score_cutoff < abs_diff (s1.size (), s2.size ())) return score_cutoff + 1 ;
7655
7652
@@ -7707,7 +7704,7 @@ size_t uniform_levenshtein_distance(Range<InputIt1> s1, Range<InputIt2> s2, size
7707
7704
if (score_hint < 31 ) score_hint = 31 ;
7708
7705
7709
7706
// when no differences are allowed a direct comparision is sufficient
7710
- if (score_cutoff == 0 ) return ! std::equal (s1. begin (), s1. end (), s2. begin (), s2. end ()) ;
7707
+ if (score_cutoff == 0 ) return s1 != s2;
7711
7708
7712
7709
// at least length difference insertions/deletions required
7713
7710
if (score_cutoff < (s1.size () - s2.size ())) return score_cutoff + 1 ;
@@ -8635,12 +8632,12 @@ void osa_hyrroe2003_simd(Range<size_t*> scores, const detail::BlockPatternMatchV
8635
8632
native_simd<VecType> PM_j_old (VecType (0 ));
8636
8633
8637
8634
alignas (alignment) std::array<VecType, vec_width> currDist_;
8638
- unroll<int , vec_width>(
8635
+ unroll<size_t , vec_width>(
8639
8636
[&](auto i) { currDist_[i] = static_cast <VecType>(s1_lengths[result_index + i]); });
8640
8637
native_simd<VecType> currDist (reinterpret_cast <uint64_t *>(currDist_.data ()));
8641
8638
/* mask used when computing D[m,j] in the paper 10^(m-1) */
8642
8639
alignas (alignment) std::array<VecType, vec_width> mask_;
8643
- unroll<int , vec_width>([&](auto i) {
8640
+ unroll<size_t , vec_width>([&](auto i) {
8644
8641
if (s1_lengths[result_index + i] == 0 )
8645
8642
mask_[i] = 0 ;
8646
8643
else
@@ -8651,7 +8648,7 @@ void osa_hyrroe2003_simd(Range<size_t*> scores, const detail::BlockPatternMatchV
8651
8648
for (const auto & ch : s2) {
8652
8649
/* Step 1: Computing D0 */
8653
8650
alignas (alignment) std::array<uint64_t , vecs> stored;
8654
- unroll<int , vecs>([&](auto i) { stored[i] = block.get (cur_vec + i, ch); });
8651
+ unroll<size_t , vecs>([&](auto i) { stored[i] = block.get (cur_vec + i, ch); });
8655
8652
8656
8653
native_simd<VecType> PM_j (stored.data ());
8657
8654
auto TR = (andnot (PM_j, D0) << 1 ) & PM_j_old;
@@ -8678,7 +8675,7 @@ void osa_hyrroe2003_simd(Range<size_t*> scores, const detail::BlockPatternMatchV
8678
8675
alignas (alignment) std::array<VecType, vec_width> distances;
8679
8676
currDist.store (distances.data ());
8680
8677
8681
- unroll<int , vec_width>([&](auto i) {
8678
+ unroll<size_t , vec_width>([&](auto i) {
8682
8679
size_t score = 0 ;
8683
8680
/* strings of length 0 are not handled correctly */
8684
8681
if (s1_lengths[result_index] == 0 ) {
0 commit comments