|
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: 2023-10-31 11:48:55.108653 |
| 4 | +// Generated: 2023-11-01 00:20:18.570286 |
5 | 5 | // ---------------------------------------------------------- |
6 | 6 | // This file is an amalgamation of multiple different files. |
7 | 7 | // You probably shouldn't edit it directly. |
@@ -1629,6 +1629,24 @@ size_t remove_common_suffix(Range<InputIt1>& s1, Range<InputIt2>& s2); |
1629 | 1629 | template <typename InputIt, typename CharT = iter_value_t<InputIt>> |
1630 | 1630 | SplittedSentenceView<InputIt> sorted_split(InputIt first, InputIt last); |
1631 | 1631 |
|
| 1632 | +static inline void* rf_aligned_alloc(size_t alignment, size_t size) |
| 1633 | +{ |
| 1634 | +#if defined(_WIN32) |
| 1635 | + return _aligned_malloc(size, alignment); |
| 1636 | +#else |
| 1637 | + return aligned_alloc(alignment, size); |
| 1638 | +#endif |
| 1639 | +} |
| 1640 | + |
| 1641 | +static inline void rf_aligned_free(void* ptr) |
| 1642 | +{ |
| 1643 | +#if defined(_WIN32) |
| 1644 | + _aligned_free(ptr); |
| 1645 | +#else |
| 1646 | + free(ptr); |
| 1647 | +#endif |
| 1648 | +} |
| 1649 | + |
1632 | 1650 | /**@}*/ |
1633 | 1651 |
|
1634 | 1652 | } // namespace rapidfuzz::detail |
@@ -5823,15 +5841,12 @@ jaro_similarity_simd_long_s2(Range<double*> scores, const detail::BlockPatternMa |
5823 | 5841 | assert(static_cast<size_t>(s2.size()) > sizeof(VecType) * 8); |
5824 | 5842 |
|
5825 | 5843 | struct AlignedAlloc { |
5826 | | - AlignedAlloc(size_t size) |
5827 | | - { |
5828 | | - // work around compilation failure in msvc |
5829 | | - memory = operator new[](size, std::align_val_t(native_simd<VecType>::alignment)); |
5830 | | - } |
| 5844 | + AlignedAlloc(size_t size) : memory(rf_aligned_alloc(native_simd<VecType>::alignment, size)) |
| 5845 | + {} |
5831 | 5846 |
|
5832 | 5847 | ~AlignedAlloc() |
5833 | 5848 | { |
5834 | | - ::operator delete[](memory, std::align_val_t(native_simd<VecType>::alignment)); |
| 5849 | + rf_aligned_free(memory); |
5835 | 5850 | } |
5836 | 5851 |
|
5837 | 5852 | void* memory = nullptr; |
@@ -6199,15 +6214,14 @@ struct MultiJaro : public detail::MultiSimilarityBase<MultiJaro<MaxLen>, double, |
6199 | 6214 | /* align for avx2 so we can directly load into avx2 registers */ |
6200 | 6215 | str_lens_size = result_count(); |
6201 | 6216 |
|
6202 | | - // work around compilation failure in msvc |
6203 | | - str_lens = static_cast<VecType*>(operator new[](sizeof(VecType) * str_lens_size, |
6204 | | - std::align_val_t(get_vec_alignment()))); |
| 6217 | + str_lens = static_cast<VecType*>( |
| 6218 | + detail::rf_aligned_alloc(get_vec_alignment(), sizeof(VecType) * str_lens_size)); |
6205 | 6219 | std::fill(str_lens, str_lens + str_lens_size, VecType(0)); |
6206 | 6220 | } |
6207 | 6221 |
|
6208 | 6222 | ~MultiJaro() |
6209 | 6223 | { |
6210 | | - ::operator delete[](str_lens, std::align_val_t(get_vec_alignment())); |
| 6224 | + detail::rf_aligned_free(str_lens); |
6211 | 6225 | } |
6212 | 6226 |
|
6213 | 6227 | /** |
|
0 commit comments