Skip to content
This repository was archived by the owner on Jul 16, 2025. It is now read-only.

Commit 35f6b99

Browse files
committed
1 parent ee2f79d commit 35f6b99

File tree

39 files changed

+279
-265
lines changed

39 files changed

+279
-265
lines changed

third-parties/fast_io/include/fast_io_core_impl/allocation/adapters.h

Lines changed: 137 additions & 158 deletions
Large diffs are not rendered by default.

third-parties/fast_io/include/fast_io_core_impl/allocation/mimalloc_driver.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ __declspec(dllimport)
205205
#if __has_cpp_attribute(__gnu__::__cdecl__) && ((defined(_WIN32) && !defined(__WINE__)) || defined(__CYGWIN__))
206206
[[__gnu__::__cdecl__]]
207207
#endif
208-
extern void *
208+
extern void
209209
#if !__has_cpp_attribute(__gnu__::__cdecl__) && defined(_MSC_VER)
210210
__cdecl
211211
#endif
@@ -214,12 +214,12 @@ extern void *
214214
#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) && \
215215
((defined(_WIN32) && !defined(__WINE__)) || defined(__CYGWIN__))
216216
#if !defined(__clang__)
217-
__asm__("mi_calloc_aligned")
217+
__asm__("mi_free_aligned")
218218
#else
219-
__asm__("_mi_calloc_aligned")
219+
__asm__("_mi_free_aligned")
220220
#endif
221221
#else
222-
__asm__("mi_calloc_aligned")
222+
__asm__("mi_free_aligned")
223223
#endif
224224
#endif
225225
;

third-parties/fast_io/include/fast_io_core_impl/allocation/msvc/msvc_linker_32.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#pragma comment(linker, "/alternatename:__imp_?HeapFree@win32@fast_io@@YAHPAXI0@Z=__imp_HeapFree")
66
#pragma comment(linker, "/alternatename:__imp_?GetProcessHeap@win32@fast_io@@YAPAXXZ=__imp_GetProcessHeap")
77
#pragma comment(linker, "/alternatename:__imp_?HeapReAlloc@win32@fast_io@@YAPAXPAXI0I@Z=__imp_HeapReAlloc")
8-
#pragma comment(linker, "/alternatename:__imp_?HeapSize@win32@fast_io@@YAIPAXIPBX@Z=__imp_HeapFree")
8+
#pragma comment(linker, "/alternatename:__imp_?HeapSize@win32@fast_io@@YAIPAXIPBX@Z=__imp_HeapSize")
99
#pragma comment(linker, "/alternatename:__imp_?RtlAllocateHeap@nt@win32@fast_io@@YAPAXPAXII@Z=__imp_RtlAllocateHeap")
1010
#pragma comment(linker, "/alternatename:__imp_?RtlFreeHeap@nt@win32@fast_io@@YAEPAXI0@Z=__imp_RtlFreeHeap")
1111
#pragma comment(linker, "/alternatename:__imp_?RtlGetCurrentPeb@nt@win32@fast_io@@YAPAUpeb@123@XZ=__imp_RtlGetCurrentPeb")

third-parties/fast_io/include/fast_io_core_impl/bitops/rtz.h

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -35,49 +35,49 @@ inline constexpr ::fast_io::bitops::rtz_result<T> rtz_impl(T n) noexcept
3535
}
3636
else
3737
{
38-
std::size_t s{};
38+
::std::size_t s{};
3939

4040
if constexpr (!iec559)
4141
{
4242
constexpr ::std::uint_least64_t c0{230079197716545u};
43-
::std::uint_least64_t r{::std::rotr(static_cast<std::uint64_t>(n * c0), 16)};
43+
::std::uint_least64_t r{::std::rotr(static_cast<::std::uint64_t>(n * c0), 16)};
4444
constexpr ::std::uint_least64_t d0{1845u};
4545
bool b{r < d0};
4646
s += s;
47-
s += b;
47+
s += static_cast<::std::size_t>(b);
4848
n = b ? r : n;
4949
}
5050

5151
constexpr ::std::uint_least64_t c0{28999941890838049u};
52-
::std::uint_least64_t r{::std::rotr(static_cast<std::uint64_t>(n * c0), 8)};
52+
::std::uint_least64_t r{::std::rotr(static_cast<::std::uint64_t>(n * c0), 8)};
5353
constexpr ::std::uint_least64_t d0{184467440738u};
5454
bool b{r < d0};
5555
s += s;
56-
s += b;
56+
s += static_cast<::std::size_t>(b);
5757
n = b ? r : n;
5858

5959
constexpr ::std::uint_least64_t c1{182622766329724561u};
60-
r = ::std::rotr(static_cast<std::uint64_t>(n * c1), 4);
60+
r = ::std::rotr(static_cast<::std::uint64_t>(n * c1), 4);
6161
constexpr ::std::uint_least64_t d1{1844674407370956u};
6262
b = r < d1;
6363
s += s;
64-
s += b;
64+
s += static_cast<::std::size_t>(b);
6565
n = b ? r : n;
6666

6767
constexpr ::std::uint_least64_t c2{10330176681277348905u};
68-
r = ::std::rotr(static_cast<std::uint64_t>(n * c2), 2);
68+
r = ::std::rotr(static_cast<::std::uint64_t>(n * c2), 2);
6969
constexpr ::std::uint_least64_t d2{184467440737095517u};
7070
b = r < d2;
7171
s += s;
72-
s += b;
72+
s += static_cast<::std::size_t>(b);
7373
n = b ? r : n;
7474

7575
constexpr ::std::uint_least64_t c3{14757395258967641293u};
76-
r = ::std::rotr(static_cast<std::uint64_t>(n * c3), 1);
76+
r = ::std::rotr(static_cast<::std::uint64_t>(n * c3), 1);
7777
constexpr ::std::uint_least64_t d3{1844674407370955162u};
7878
b = r < d3;
7979
s += s;
80-
s += b;
80+
s += static_cast<::std::size_t>(b);
8181
n = b ? r : n;
8282

8383
return {n, s};
@@ -102,36 +102,36 @@ inline constexpr ::fast_io::bitops::rtz_result<T> rtz_impl(T n) noexcept
102102
if constexpr (!iec559)
103103
{
104104
constexpr ::std::uint_least64_t c0{15273505u};
105-
::std::uint_least64_t r{::std::rotr(static_cast<std::uint32_t>(n * c0), 8)};
106-
constexpr ::std::uint_least64_t d0{43u};
105+
::std::uint_least32_t r{::std::rotr(static_cast<::std::uint32_t>(n * c0), 8)};
106+
constexpr ::std::uint_least32_t d0{43u};
107107
bool b{r < d0};
108108
s += s;
109-
s += b;
109+
s += static_cast<::std::size_t>(b);
110110
n = b ? r : n;
111111
}
112112

113113
constexpr ::std::uint_least32_t c0{184254097u};
114-
::std::uint_least32_t r{::std::rotr(static_cast<std::uint32_t>(n * c0), 4)};
114+
::std::uint_least32_t r{::std::rotr(static_cast<::std::uint32_t>(n * c0), 4)};
115115
constexpr ::std::uint_least32_t d0{429497u};
116116
bool b{r < d0};
117117
s += s;
118-
s += b;
118+
s += static_cast<::std::size_t>(b);
119119
n = b ? r : n;
120120

121121
// c1 == d1 == 42949673u
122122
constexpr ::std::uint_least32_t d1{42949673u};
123-
r = ::std::rotr(static_cast<std::uint32_t>(n * d1), 2);
123+
r = ::std::rotr(static_cast<::std::uint32_t>(n * d1), 2);
124124
b = r < d1;
125125
s += s;
126-
s += b;
126+
s += static_cast<::std::size_t>(b);
127127
n = b ? r : n;
128128

129129
constexpr ::std::uint_least32_t c2{1288490189u};
130-
r = ::std::rotr(static_cast<std::uint32_t>(n * c2), 1);
130+
r = ::std::rotr(static_cast<::std::uint32_t>(n * c2), 1);
131131
constexpr ::std::uint_least32_t d2{429496730u};
132132
b = r < d2;
133133
s += s;
134-
s += b;
134+
s += static_cast<::std::size_t>(b);
135135
n = b ? r : n;
136136

137137
return {n, s};

third-parties/fast_io/include/fast_io_core_impl/char_category/char_category.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1706,7 +1706,7 @@ template <::std::integral char_type>
17061706
inline constexpr bool is_c_blank(char_type ch) noexcept
17071707
{
17081708
return (ch == ::fast_io::char_literal_v<u8' ', char_type>) |
1709-
(ch == ::fast_io::char_literal_v<u8'\v', char_type>);
1709+
(ch == ::fast_io::char_literal_v<u8'\t', char_type>);
17101710
}
17111711

17121712
template <::std::integral char_type>

third-parties/fast_io/include/fast_io_core_impl/char_category/char_category_traits.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,15 @@ class char_category_traits
167167
}
168168
return last;
169169
}
170+
171+
#if 0
170172
template <::std::forward_iterator Iter>
171173
static inline constexpr bool is(Iter first, Iter last) noexcept
172-
{
174+
{
175+
/// @error Missing Functions
173176
return find_first_not(first, last) == last;
174177
}
178+
#endif
175179
};
176180

177181
using c_alnum = ::fast_io::char_category::char_category_traits<::fast_io::char_category::char_category_family::c_alnum, false>;

third-parties/fast_io/include/fast_io_core_impl/codecvt/general.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ general_code_cvt(src_char_type const *src_first, src_char_type const *src_last,
9797
for (; src_first != src_last; ++src_first)
9898
{
9999
*dst = byte_swap(*src_first);
100+
++dst;
100101
}
101102
return {src_first, dst};
102103
}
@@ -545,7 +546,8 @@ inline constexpr dest_char_type *general_code_cvt_full(src_char_type const *src_
545546
}
546547
else
547548
{
548-
new_dst += get_general_invalid_code_units<encoding>(dst);
549+
/// @error det -> new_dst?
550+
new_dst += get_general_invalid_code_units<encoding>(new_dst);
549551
}
550552
}
551553
return new_dst;

third-parties/fast_io/include/fast_io_core_impl/codecvt/utf.h

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,13 @@ template <::std::size_t src_char_type_size, ::std::size_t dest_char_type_size>
6969
requires((dest_char_type_size <= 4) && (src_char_type_size <= 4))
7070
inline constexpr ::std::size_t cal_full_reserve_size(::std::size_t internal_size) noexcept
7171
{
72-
constexpr ::std::size_t external_max{::std::numeric_limits<::std::size_t>::max() / dest_char_type_size};
72+
[[maybe_unused]] constexpr ::std::size_t external_max{::std::numeric_limits<::std::size_t>::max() / dest_char_type_size};
7373
constexpr ::std::size_t internal_max{::std::numeric_limits<::std::size_t>::max() / src_char_type_size};
7474
if constexpr (src_char_type_size == 4)
7575
{
7676
if constexpr (dest_char_type_size == 4)
7777
{
78-
constexpr ::std::size_t imax{external_max};
78+
constexpr ::std::size_t imax{internal_max};
7979
if (internal_size >= imax)
8080
{
8181
fast_terminate();
@@ -84,7 +84,7 @@ inline constexpr ::std::size_t cal_full_reserve_size(::std::size_t internal_size
8484
}
8585
else if constexpr (dest_char_type_size == 2)
8686
{
87-
constexpr ::std::size_t imax{external_max / 2};
87+
constexpr ::std::size_t imax{internal_max / 2};
8888
if (internal_size >= imax)
8989
{
9090
fast_terminate();
@@ -93,7 +93,7 @@ inline constexpr ::std::size_t cal_full_reserve_size(::std::size_t internal_size
9393
}
9494
else
9595
{
96-
constexpr ::std::size_t imax{external_max / 8};
96+
constexpr ::std::size_t imax{internal_max / 8};
9797
if (internal_size >= imax)
9898
{
9999
fast_terminate();
@@ -105,7 +105,7 @@ inline constexpr ::std::size_t cal_full_reserve_size(::std::size_t internal_size
105105
{
106106
if constexpr (dest_char_type_size == 4)
107107
{
108-
constexpr ::std::size_t imax{external_max};
108+
constexpr ::std::size_t imax{internal_max};
109109
if (internal_size >= imax)
110110
{
111111
fast_terminate();
@@ -114,7 +114,7 @@ inline constexpr ::std::size_t cal_full_reserve_size(::std::size_t internal_size
114114
}
115115
else if constexpr (dest_char_type_size == 2)
116116
{
117-
constexpr ::std::size_t imax{external_max / 2};
117+
constexpr ::std::size_t imax{internal_max / 2};
118118
if (internal_size >= imax)
119119
{
120120
fast_terminate();
@@ -123,7 +123,7 @@ inline constexpr ::std::size_t cal_full_reserve_size(::std::size_t internal_size
123123
}
124124
else
125125
{
126-
constexpr ::std::size_t imax{external_max / 8};
126+
constexpr ::std::size_t imax{internal_max / 8};
127127
if (internal_size >= imax)
128128
{
129129
fast_terminate();
@@ -135,7 +135,7 @@ inline constexpr ::std::size_t cal_full_reserve_size(::std::size_t internal_size
135135
{
136136
if constexpr (dest_char_type_size == 4)
137137
{
138-
constexpr ::std::size_t imax{external_max};
138+
constexpr ::std::size_t imax{internal_max};
139139
if (internal_size >= imax)
140140
{
141141
fast_terminate();
@@ -167,13 +167,13 @@ template <::std::size_t src_char_type_size, ::std::size_t dest_char_type_size>
167167
requires((dest_char_type_size <= 4) && (src_char_type_size <= 4))
168168
inline constexpr ::std::size_t cal_decorated_reserve_size(::std::size_t internal_size) noexcept
169169
{
170-
constexpr ::std::size_t external_max{::std::numeric_limits<::std::size_t>::max() / dest_char_type_size};
170+
[[maybe_unused]] constexpr ::std::size_t external_max{::std::numeric_limits<::std::size_t>::max() / dest_char_type_size};
171171
constexpr ::std::size_t internal_max{::std::numeric_limits<::std::size_t>::max() / src_char_type_size};
172172
if constexpr (src_char_type_size == 4)
173173
{
174174
if constexpr (dest_char_type_size == 4)
175175
{
176-
constexpr ::std::size_t imax{external_max};
176+
constexpr ::std::size_t imax{internal_max};
177177
if (internal_size >= imax)
178178
{
179179
fast_terminate();
@@ -182,7 +182,7 @@ inline constexpr ::std::size_t cal_decorated_reserve_size(::std::size_t internal
182182
}
183183
else if constexpr (dest_char_type_size == 2)
184184
{
185-
constexpr ::std::size_t imax{external_max / 2};
185+
constexpr ::std::size_t imax{internal_max / 2};
186186
if (internal_size >= imax)
187187
{
188188
fast_terminate();
@@ -191,7 +191,7 @@ inline constexpr ::std::size_t cal_decorated_reserve_size(::std::size_t internal
191191
}
192192
else
193193
{
194-
constexpr ::std::size_t imax{external_max / 8};
194+
constexpr ::std::size_t imax{internal_max / 8};
195195
if (internal_size >= imax)
196196
{
197197
fast_terminate();
@@ -203,7 +203,7 @@ inline constexpr ::std::size_t cal_decorated_reserve_size(::std::size_t internal
203203
{
204204
if constexpr (dest_char_type_size == 4)
205205
{
206-
constexpr ::std::size_t imax{external_max - 1};
206+
constexpr ::std::size_t imax{internal_max - 1};
207207
if (internal_size >= imax)
208208
{
209209
fast_terminate();
@@ -212,7 +212,7 @@ inline constexpr ::std::size_t cal_decorated_reserve_size(::std::size_t internal
212212
}
213213
else if constexpr (dest_char_type_size == 2)
214214
{
215-
constexpr ::std::size_t imax{external_max / 2 - 1};
215+
constexpr ::std::size_t imax{internal_max / 2 - 1};
216216
if (internal_size >= imax)
217217
{
218218
fast_terminate();
@@ -221,7 +221,7 @@ inline constexpr ::std::size_t cal_decorated_reserve_size(::std::size_t internal
221221
}
222222
else
223223
{
224-
constexpr ::std::size_t imax{external_max / 8 - 1};
224+
constexpr ::std::size_t imax{internal_max / 8 - 1};
225225
if (internal_size >= imax)
226226
{
227227
fast_terminate();
@@ -233,7 +233,7 @@ inline constexpr ::std::size_t cal_decorated_reserve_size(::std::size_t internal
233233
{
234234
if constexpr (dest_char_type_size == 4)
235235
{
236-
constexpr ::std::size_t imax{external_max - 7};
236+
constexpr ::std::size_t imax{internal_max - 7};
237237
if (internal_size >= imax)
238238
{
239239
fast_terminate();
@@ -503,6 +503,8 @@ template <::std::integral T, ::std::integral U>
503503
requires((sizeof(T) == 1) && (sizeof(U) == 1 || sizeof(U) == 2 || sizeof(U) == 4))
504504
inline code_cvt_result<T, U> convert_ascii_with_sse(T const *__restrict pSrc, U *__restrict pDst) noexcept
505505
{
506+
// No internal buffer judgment, external calls need to be judged
507+
506508
::std::uint_least32_t mask;
507509
#if (defined(__GNUC__) || defined(__clang__)) && !defined(__INTEL_COMPILER)
508510
using namespace fast_io::intrinsics;

third-parties/fast_io/include/fast_io_core_impl/concat/concat_buffer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ basic_concat_buffer_strlike_reserve_cold_impl(::fast_io::details::basic_concat_b
7272
auto old_buffer_begin_ptr{str.buffer_begin};
7373
bool onstack{old_buffer_begin_ptr == str.stack_buffer};
7474
auto newptr{allocate_iobuf_space<char_type>(n)};
75+
// newptr != nullptr
7576
::std::size_t const elements{static_cast<::std::size_t>(str.buffer_curr - str.buffer_begin)};
7677
auto newcurr_ptr{non_overlapped_copy_n(old_buffer_begin_ptr, elements, newptr)};
7778
str.buffer_curr = newcurr_ptr;

third-parties/fast_io/include/fast_io_core_impl/concepts/operation.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ concept contiguous_scannable = requires(char_type const *begin, char_type const
3838
/// @struct your_context_type
3939
/// @brief The context object, usually stores partial results.
4040
/// @fn scan_context_define
41-
/// @breif Partially scans an object from a contiguous memory region with a context object.
41+
/// @brief Partially scans an object from a contiguous memory region with a context object.
4242
/// @tparam <auto-inferred>
4343
/// @param ::fast_io::io_reserve_type_t<char_type, T> tag-invoke
4444
/// @param your_context_type& the context object
@@ -49,7 +49,7 @@ concept contiguous_scannable = requires(char_type const *begin, char_type const
4949
/// and a parse code indicating parsing state
5050
/// @note It's not recommended to write to T if the scanning is still partial, so as to hold strong exception guarantee.
5151
/// @fn scan_context_eof_define
52-
/// @breif Indicates that the scanning meets an EOF.
52+
/// @brief Indicates that the scanning meets an EOF.
5353
/// @tparam <auto-inferred>
5454
/// @param ::fast_io::io_reserve_type_t<char_type, T> tag-invoke
5555
/// @param your_context_type& the context object
@@ -130,7 +130,7 @@ concept dynamic_reserve_printable = ::std::integral<char_type> && requires(T t,
130130
/// @struct your_context_type
131131
/// @brief The context object, usually stores the progress of printing.
132132
/// @fn print_context_define
133-
/// @breif Partially prints an object to a buffer with a context object.
133+
/// @brief Partially prints an object to a buffer with a context object.
134134
/// @tparam <auto-inferred>
135135
/// @param this the context object
136136
/// @param T the object to be printed

0 commit comments

Comments
 (0)