@@ -34,29 +34,28 @@ namespace rapidfuzz {
3434 * @return Hamming distance between s1 and s2
3535 */
3636template <typename InputIt1, typename InputIt2>
37- int64_t hamming_distance (InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, bool pad_ = true ,
38- int64_t score_cutoff = std::numeric_limits<int64_t >::max())
37+ size_t hamming_distance (InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, bool pad_ = true ,
38+ size_t score_cutoff = std::numeric_limits<size_t >::max())
3939{
4040 return detail::Hamming::distance (first1, last1, first2, last2, pad_, score_cutoff, score_cutoff);
4141}
4242
4343template <typename Sentence1, typename Sentence2>
44- int64_t hamming_distance (const Sentence1& s1, const Sentence2& s2, bool pad_ = true ,
45- int64_t score_cutoff = std::numeric_limits<int64_t >::max())
44+ size_t hamming_distance (const Sentence1& s1, const Sentence2& s2, bool pad_ = true ,
45+ size_t score_cutoff = std::numeric_limits<size_t >::max())
4646{
4747 return detail::Hamming::distance (s1, s2, pad_, score_cutoff, score_cutoff);
4848}
4949
5050template <typename InputIt1, typename InputIt2>
51- int64_t hamming_similarity (InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, bool pad_ = true ,
52- int64_t score_cutoff = 0 )
51+ size_t hamming_similarity (InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, bool pad_ = true ,
52+ size_t score_cutoff = 0 )
5353{
5454 return detail::Hamming::similarity (first1, last1, first2, last2, pad_, score_cutoff, score_cutoff);
5555}
5656
5757template <typename Sentence1, typename Sentence2>
58- int64_t hamming_similarity (const Sentence1& s1, const Sentence2& s2, bool pad_ = true ,
59- int64_t score_cutoff = 0 )
58+ size_t hamming_similarity (const Sentence1& s1, const Sentence2& s2, bool pad_ = true , size_t score_cutoff = 0 )
6059{
6160 return detail::Hamming::similarity (s1, s2, pad_, score_cutoff, score_cutoff);
6261}
@@ -78,15 +77,15 @@ double hamming_normalized_distance(const Sentence1& s1, const Sentence2& s2, boo
7877
7978template <typename InputIt1, typename InputIt2>
8079Editops hamming_editops (InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, bool pad_ = true ,
81- int64_t score_hint = std::numeric_limits<int64_t >::max())
80+ size_t score_hint = std::numeric_limits<size_t >::max())
8281{
8382 return detail::hamming_editops (detail::Range (first1, last1), detail::Range (first2, last2), pad_,
8483 score_hint);
8584}
8685
8786template <typename Sentence1, typename Sentence2>
8887Editops hamming_editops (const Sentence1& s1, const Sentence2& s2, bool pad_ = true ,
89- int64_t score_hint = std::numeric_limits<int64_t >::max())
88+ size_t score_hint = std::numeric_limits<size_t >::max())
9089{
9190 return detail::hamming_editops (detail::Range (s1), detail::Range (s2), pad_, score_hint);
9291}
@@ -131,7 +130,7 @@ double hamming_normalized_similarity(const Sentence1& s1, const Sentence2& s2, b
131130}
132131
133132template <typename CharT1>
134- struct CachedHamming : public detail ::CachedDistanceBase<CachedHamming<CharT1>, int64_t , 0 ,
133+ struct CachedHamming : public detail ::CachedDistanceBase<CachedHamming<CharT1>, size_t , 0 ,
135134 std::numeric_limits<int64_t >::max()> {
136135 template <typename Sentence1>
137136 explicit CachedHamming (const Sentence1& s1_, bool pad_ = true )
@@ -143,18 +142,18 @@ struct CachedHamming : public detail::CachedDistanceBase<CachedHamming<CharT1>,
143142 {}
144143
145144private:
146- friend detail::CachedDistanceBase<CachedHamming<CharT1>, int64_t , 0 , std::numeric_limits<int64_t >::max()>;
145+ friend detail::CachedDistanceBase<CachedHamming<CharT1>, size_t , 0 , std::numeric_limits<int64_t >::max()>;
147146 friend detail::CachedNormalizedMetricBase<CachedHamming<CharT1>>;
148147
149148 template <typename InputIt2>
150- int64_t maximum (const detail::Range<InputIt2>& s2) const
149+ size_t maximum (const detail::Range<InputIt2>& s2) const
151150 {
152- return static_cast < int64_t >( std::max (s1.size (), s2.size () ));
151+ return std::max (s1.size (), s2.size ());
153152 }
154153
155154 template <typename InputIt2>
156- int64_t _distance (const detail::Range<InputIt2>& s2, int64_t score_cutoff,
157- [[maybe_unused]] int64_t score_hint) const
155+ size_t _distance (const detail::Range<InputIt2>& s2, size_t score_cutoff,
156+ [[maybe_unused]] size_t score_hint) const
158157 {
159158 return detail::Hamming::distance (s1, s2, pad, score_cutoff, score_hint);
160159 }
0 commit comments