Skip to content

Commit f91ce8f

Browse files
committed
Merge remote-tracking branch 'upstream/main' into quotes_on_internal_includes
2 parents e23eb7c + 5d078a9 commit f91ce8f

File tree

6 files changed

+56
-33
lines changed

6 files changed

+56
-33
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
## Changelog
22

3+
## [3.3.2] - 2025-02-11
4+
### Fixed
5+
- fixed compilation with old msvc versions that don't properly support if constexpr
6+
37
## [3.3.1] - 2025-01-22
48
### Fixed
59
- fixed tests not building with catch2 versions >= 3.0

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Cmake config largely taken from catch2
2-
cmake_minimum_required(VERSION 3.5)
2+
cmake_minimum_required(VERSION 3.5..3.31)
33

44
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.24)
55
cmake_policy(SET CMP0135 NEW)
@@ -32,7 +32,7 @@ if (CMAKE_BINARY_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
3232
message(FATAL_ERROR "Building in-source is not supported! Create a build dir and remove ${CMAKE_SOURCE_DIR}/CMakeCache.txt")
3333
endif()
3434

35-
project(rapidfuzz LANGUAGES CXX VERSION 3.3.1)
35+
project(rapidfuzz LANGUAGES CXX VERSION 3.3.2)
3636

3737
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
3838
include(GNUInstallDirs)

extras/rapidfuzz_amalgamated.hpp

Lines changed: 34 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Licensed under the MIT License <http://opensource.org/licenses/MIT>.
22
// SPDX-License-Identifier: MIT
33
// RapidFuzz v1.0.2
4-
// Generated: 2024-12-25 11:44:52.213162
4+
// Generated: 2025-02-11 13:48:20.141647
55
// ----------------------------------------------------------
66
// This file is an amalgamation of multiple different files.
77
// You probably shouldn't edit it directly.
@@ -429,6 +429,17 @@ struct ShiftedBitMatrix {
429429

430430
#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
431431
# define RAPIDFUZZ_DEDUCTION_GUIDES
432+
#endif
433+
434+
/* older versions of msvc have bugs in their if constexpr support
435+
* see https://github.com/rapidfuzz/rapidfuzz-cpp/issues/122
436+
* since we don't know the exact version this was fixed in, use the earliest we could test
437+
*/
438+
#if defined(_MSC_VER) && _MSC_VER < 1920
439+
# define RAPIDFUZZ_IF_CONSTEXPR_AVAILABLE 0
440+
# define RAPIDFUZZ_IF_CONSTEXPR if
441+
#elif ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
442+
# define RAPIDFUZZ_DEDUCTION_GUIDES
432443
# define RAPIDFUZZ_IF_CONSTEXPR_AVAILABLE 1
433444
# define RAPIDFUZZ_IF_CONSTEXPR if constexpr
434445
#else
@@ -439,7 +450,7 @@ struct ShiftedBitMatrix {
439450
#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) || __cplusplus >= 201402L)
440451
# define RAPIDFUZZ_CONSTEXPR_CXX14 constexpr
441452
#else
442-
# define RAPIDFUZZ_CONSTEXPR_CXX14
453+
# define RAPIDFUZZ_CONSTEXPR_CXX14 inline
443454
#endif
444455

445456
#include <stddef.h>
@@ -2492,13 +2503,13 @@ static inline native_simd<T> min32(const native_simd<T>& a, const native_simd<T>
24922503
return _mm256_min_epu32(a, b);
24932504
}
24942505

2495-
/* taken from https://stackoverflow.com/a/51807800/11335032 */
2506+
/* taken from https://stackoverflow.com/a/51807800 */
24962507
static inline native_simd<uint8_t> sllv(const native_simd<uint8_t>& a,
24972508
const native_simd<uint8_t>& count_) noexcept
24982509
{
24992510
__m256i mask_hi = _mm256_set1_epi32(static_cast<int32_t>(0xFF00FF00));
2500-
__m256i multiplier_lut = _mm256_set_epi8(0, 0, 0, 0, 0, 0, 0, 0, char(128), 64, 32, 16, 8, 4, 2, 1, 0, 0,
2501-
0, 0, 0, 0, 0, 0, char(128), 64, 32, 16, 8, 4, 2, 1);
2511+
__m256i multiplier_lut = _mm256_set_epi8(0, 0, 0, 0, 0, 0, 0, 0, char(-128), 64, 32, 16, 8, 4, 2, 1, 0, 0,
2512+
0, 0, 0, 0, 0, 0, char(-128), 64, 32, 16, 8, 4, 2, 1);
25022513

25032514
__m256i count_sat =
25042515
_mm256_min_epu8(count_, _mm256_set1_epi8(8)); /* AVX shift counts are not masked. So a_i << n_i = 0
@@ -2515,7 +2526,7 @@ static inline native_simd<uint8_t> sllv(const native_simd<uint8_t>& a,
25152526
return x;
25162527
}
25172528

2518-
/* taken from https://stackoverflow.com/a/51805592/11335032 */
2529+
/* taken from https://stackoverflow.com/a/51805592 */
25192530
static inline native_simd<uint16_t> sllv(const native_simd<uint16_t>& a,
25202531
const native_simd<uint16_t>& count) noexcept
25212532
{
@@ -4638,8 +4649,8 @@ void lcs_simd(Range<size_t*> scores, const BlockPatternMatchVector& block, const
46384649
#endif
46394650

46404651
template <size_t N, bool RecordMatrix, typename PMV, typename InputIt1, typename InputIt2>
4641-
auto lcs_unroll(const PMV& block, const Range<InputIt1>&, const Range<InputIt2>& s2,
4642-
size_t score_cutoff = 0) -> LCSseqResult<RecordMatrix>
4652+
auto lcs_unroll(const PMV& block, const Range<InputIt1>&, const Range<InputIt2>& s2, size_t score_cutoff = 0)
4653+
-> LCSseqResult<RecordMatrix>
46434654
{
46444655
uint64_t S[N];
46454656
unroll<size_t, N>([&](size_t i) { S[i] = ~UINT64_C(0); });
@@ -6838,12 +6849,12 @@ struct CachedJaroWinkler : public detail::CachedSimilarityBase<CachedJaroWinkler
68386849

68396850
#ifdef RAPIDFUZZ_DEDUCTION_GUIDES
68406851
template <typename Sentence1>
6841-
explicit CachedJaroWinkler(const Sentence1& s1_,
6842-
double _prefix_weight = 0.1) -> CachedJaroWinkler<char_type<Sentence1>>;
6852+
explicit CachedJaroWinkler(const Sentence1& s1_, double _prefix_weight = 0.1)
6853+
-> CachedJaroWinkler<char_type<Sentence1>>;
68436854

68446855
template <typename InputIt1>
6845-
CachedJaroWinkler(InputIt1 first1, InputIt1 last1,
6846-
double _prefix_weight = 0.1) -> CachedJaroWinkler<iter_value_t<InputIt1>>;
6856+
CachedJaroWinkler(InputIt1 first1, InputIt1 last1, double _prefix_weight = 0.1)
6857+
-> CachedJaroWinkler<iter_value_t<InputIt1>>;
68476858
#endif
68486859

68496860
} // namespace rapidfuzz
@@ -7346,8 +7357,8 @@ size_t levenshtein_hyrroe2003_small_band(const BlockPatternMatchVector& PM, cons
73467357
}
73477358

73487359
template <bool RecordMatrix, typename InputIt1, typename InputIt2>
7349-
auto levenshtein_hyrroe2003_small_band(const Range<InputIt1>& s1, const Range<InputIt2>& s2,
7350-
size_t max) -> LevenshteinResult<RecordMatrix, false>
7360+
auto levenshtein_hyrroe2003_small_band(const Range<InputIt1>& s1, const Range<InputIt2>& s2, size_t max)
7361+
-> LevenshteinResult<RecordMatrix, false>
73517362
{
73527363
assert(max <= s1.size());
73537364
assert(max <= s2.size());
@@ -8014,9 +8025,6 @@ HirschbergPos find_hirschberg_pos(const Range<InputIt1>& s1, const Range<InputIt
80148025
}
80158026
}
80168027

8017-
assert(hpos.left_score >= 0);
8018-
assert(hpos.right_score >= 0);
8019-
80208028
if (hpos.left_score + hpos.right_score > max)
80218029
return find_hirschberg_pos(s1, s2, max * 2);
80228030
else {
@@ -8580,12 +8588,12 @@ struct CachedLevenshtein : public detail::CachedDistanceBase<CachedLevenshtein<C
85808588

85818589
#ifdef RAPIDFUZZ_DEDUCTION_GUIDES
85828590
template <typename Sentence1>
8583-
explicit CachedLevenshtein(const Sentence1& s1_, LevenshteinWeightTable aWeights = {
8584-
1, 1, 1}) -> CachedLevenshtein<char_type<Sentence1>>;
8591+
explicit CachedLevenshtein(const Sentence1& s1_, LevenshteinWeightTable aWeights = {1, 1, 1})
8592+
-> CachedLevenshtein<char_type<Sentence1>>;
85858593

85868594
template <typename InputIt1>
8587-
CachedLevenshtein(InputIt1 first1, InputIt1 last1,
8588-
LevenshteinWeightTable aWeights = {1, 1, 1}) -> CachedLevenshtein<iter_value_t<InputIt1>>;
8595+
CachedLevenshtein(InputIt1 first1, InputIt1 last1, LevenshteinWeightTable aWeights = {1, 1, 1})
8596+
-> CachedLevenshtein<iter_value_t<InputIt1>>;
85898597
#endif
85908598

85918599
} // namespace rapidfuzz
@@ -9538,7 +9546,7 @@ namespace rapidfuzz {
95389546
namespace detail {
95399547

95409548
/*
9541-
* taken from https://stackoverflow.com/a/17251989/11335032
9549+
* taken from https://stackoverflow.com/a/17251989
95429550
*/
95439551
template <typename T, typename U>
95449552
bool CanTypeFitValue(const U value)
@@ -9961,8 +9969,8 @@ explicit CachedPartialTokenSortRatio(const Sentence1& s1)
99619969
-> CachedPartialTokenSortRatio<char_type<Sentence1>>;
99629970

99639971
template <typename InputIt1>
9964-
CachedPartialTokenSortRatio(InputIt1 first1,
9965-
InputIt1 last1) -> CachedPartialTokenSortRatio<iter_value_t<InputIt1>>;
9972+
CachedPartialTokenSortRatio(InputIt1 first1, InputIt1 last1)
9973+
-> CachedPartialTokenSortRatio<iter_value_t<InputIt1>>;
99669974
#endif
99679975

99689976
/**
@@ -10089,8 +10097,8 @@ template <typename Sentence1>
1008910097
explicit CachedPartialTokenSetRatio(const Sentence1& s1) -> CachedPartialTokenSetRatio<char_type<Sentence1>>;
1009010098

1009110099
template <typename InputIt1>
10092-
CachedPartialTokenSetRatio(InputIt1 first1,
10093-
InputIt1 last1) -> CachedPartialTokenSetRatio<iter_value_t<InputIt1>>;
10100+
CachedPartialTokenSetRatio(InputIt1 first1, InputIt1 last1)
10101+
-> CachedPartialTokenSetRatio<iter_value_t<InputIt1>>;
1009410102
#endif
1009510103

1009610104
/**

rapidfuzz/details/CharSet.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace rapidfuzz {
1313
namespace detail {
1414

1515
/*
16-
* taken from https://stackoverflow.com/a/17251989/11335032
16+
* taken from https://stackoverflow.com/a/17251989
1717
*/
1818
template <typename T, typename U>
1919
bool CanTypeFitValue(const U value)

rapidfuzz/details/config.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@
55

66
#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
77
# define RAPIDFUZZ_DEDUCTION_GUIDES
8+
#endif
9+
10+
/* older versions of msvc have bugs in their if constexpr support
11+
* see https://github.com/rapidfuzz/rapidfuzz-cpp/issues/122
12+
* since we don't know the exact version this was fixed in, use the earliest we could test
13+
*/
14+
#if defined(_MSC_VER) && _MSC_VER < 1920
15+
# define RAPIDFUZZ_IF_CONSTEXPR_AVAILABLE 0
16+
# define RAPIDFUZZ_IF_CONSTEXPR if
17+
#elif ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
18+
# define RAPIDFUZZ_DEDUCTION_GUIDES
819
# define RAPIDFUZZ_IF_CONSTEXPR_AVAILABLE 1
920
# define RAPIDFUZZ_IF_CONSTEXPR if constexpr
1021
#else

rapidfuzz/details/simd_avx2.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -597,13 +597,13 @@ static inline native_simd<T> min32(const native_simd<T>& a, const native_simd<T>
597597
return _mm256_min_epu32(a, b);
598598
}
599599

600-
/* taken from https://stackoverflow.com/a/51807800/11335032 */
600+
/* taken from https://stackoverflow.com/a/51807800 */
601601
static inline native_simd<uint8_t> sllv(const native_simd<uint8_t>& a,
602602
const native_simd<uint8_t>& count_) noexcept
603603
{
604604
__m256i mask_hi = _mm256_set1_epi32(static_cast<int32_t>(0xFF00FF00));
605-
__m256i multiplier_lut = _mm256_set_epi8(0, 0, 0, 0, 0, 0, 0, 0, char(128), 64, 32, 16, 8, 4, 2, 1, 0, 0,
606-
0, 0, 0, 0, 0, 0, char(128), 64, 32, 16, 8, 4, 2, 1);
605+
__m256i multiplier_lut = _mm256_set_epi8(0, 0, 0, 0, 0, 0, 0, 0, char(-128), 64, 32, 16, 8, 4, 2, 1, 0, 0,
606+
0, 0, 0, 0, 0, 0, char(-128), 64, 32, 16, 8, 4, 2, 1);
607607

608608
__m256i count_sat =
609609
_mm256_min_epu8(count_, _mm256_set1_epi8(8)); /* AVX shift counts are not masked. So a_i << n_i = 0
@@ -620,7 +620,7 @@ static inline native_simd<uint8_t> sllv(const native_simd<uint8_t>& a,
620620
return x;
621621
}
622622

623-
/* taken from https://stackoverflow.com/a/51805592/11335032 */
623+
/* taken from https://stackoverflow.com/a/51805592 */
624624
static inline native_simd<uint16_t> sllv(const native_simd<uint16_t>& a,
625625
const native_simd<uint16_t>& count) noexcept
626626
{

0 commit comments

Comments
 (0)