/src/fmt/include/fmt/format.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | Formatting library for C++ |
3 | | |
4 | | Copyright (c) 2012 - present, Victor Zverovich |
5 | | |
6 | | Permission is hereby granted, free of charge, to any person obtaining |
7 | | a copy of this software and associated documentation files (the |
8 | | "Software"), to deal in the Software without restriction, including |
9 | | without limitation the rights to use, copy, modify, merge, publish, |
10 | | distribute, sublicense, and/or sell copies of the Software, and to |
11 | | permit persons to whom the Software is furnished to do so, subject to |
12 | | the following conditions: |
13 | | |
14 | | The above copyright notice and this permission notice shall be |
15 | | included in all copies or substantial portions of the Software. |
16 | | |
17 | | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
18 | | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
19 | | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
20 | | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
21 | | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
22 | | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
23 | | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
24 | | |
25 | | --- Optional exception to the license --- |
26 | | |
27 | | As an exception, if, as a result of your compiling your source code, portions |
28 | | of this Software are embedded into a machine-executable object form of such |
29 | | source code, you may redistribute such embedded portions in such object form |
30 | | without including the above copyright and permission notices. |
31 | | */ |
32 | | |
33 | | #ifndef FMT_FORMAT_H_ |
34 | | #define FMT_FORMAT_H_ |
35 | | |
36 | | #ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES |
37 | | # define _LIBCPP_REMOVE_TRANSITIVE_INCLUDES |
38 | | # define FMT_REMOVE_TRANSITIVE_INCLUDES |
39 | | #endif |
40 | | |
41 | | #include "base.h" |
42 | | |
43 | | #ifndef FMT_MODULE |
44 | | # include <cmath> // std::signbit |
45 | | # include <cstddef> // std::byte |
46 | | # include <cstdint> // uint32_t |
47 | | # include <cstring> // std::memcpy |
48 | | # include <initializer_list> // std::initializer_list |
49 | | # include <limits> // std::numeric_limits |
50 | | # include <new> // std::bad_alloc |
51 | | # if defined(__GLIBCXX__) && !defined(_GLIBCXX_USE_DUAL_ABI) |
52 | | // Workaround for pre gcc 5 libstdc++. |
53 | | # include <memory> // std::allocator_traits |
54 | | # endif |
55 | | # include <stdexcept> // std::runtime_error |
56 | | # include <string> // std::string |
57 | | # include <system_error> // std::system_error |
58 | | |
59 | | // Check FMT_CPLUSPLUS to avoid a warning in MSVC. |
60 | | # if FMT_HAS_INCLUDE(<bit>) && FMT_CPLUSPLUS > 201703L |
61 | | # include <bit> // std::bit_cast |
62 | | # endif |
63 | | |
64 | | // libc++ supports string_view in pre-c++17. |
65 | | # if FMT_HAS_INCLUDE(<string_view>) && \ |
66 | | (FMT_CPLUSPLUS >= 201703L || defined(_LIBCPP_VERSION)) |
67 | | # include <string_view> |
68 | | # define FMT_USE_STRING_VIEW |
69 | | # endif |
70 | | |
71 | | # if FMT_MSC_VERSION |
72 | | # include <intrin.h> // _BitScanReverse[64], _BitScanForward[64], _umul128 |
73 | | # endif |
74 | | #endif // FMT_MODULE |
75 | | |
76 | | #if defined(FMT_USE_NONTYPE_TEMPLATE_ARGS) |
77 | | // Use the provided definition. |
78 | | #elif defined(__NVCOMPILER) |
79 | | # define FMT_USE_NONTYPE_TEMPLATE_ARGS 0 |
80 | | #elif FMT_GCC_VERSION >= 903 && FMT_CPLUSPLUS >= 201709L |
81 | | # define FMT_USE_NONTYPE_TEMPLATE_ARGS 1 |
82 | | #elif defined(__cpp_nontype_template_args) && \ |
83 | | __cpp_nontype_template_args >= 201911L |
84 | | # define FMT_USE_NONTYPE_TEMPLATE_ARGS 1 |
85 | | #elif FMT_CLANG_VERSION >= 1200 && FMT_CPLUSPLUS >= 202002L |
86 | | # define FMT_USE_NONTYPE_TEMPLATE_ARGS 1 |
87 | | #else |
88 | | # define FMT_USE_NONTYPE_TEMPLATE_ARGS 0 |
89 | | #endif |
90 | | |
91 | | #if defined __cpp_inline_variables && __cpp_inline_variables >= 201606L |
92 | | # define FMT_INLINE_VARIABLE inline |
93 | | #else |
94 | | # define FMT_INLINE_VARIABLE |
95 | | #endif |
96 | | |
97 | | // Check if RTTI is disabled. |
98 | | #ifdef FMT_USE_RTTI |
99 | | // Use the provided definition. |
100 | | #elif defined(__GXX_RTTI) || FMT_HAS_FEATURE(cxx_rtti) || defined(_CPPRTTI) || \ |
101 | | defined(__INTEL_RTTI__) || defined(__RTTI) |
102 | | // __RTTI is for EDG compilers. _CPPRTTI is for MSVC. |
103 | | # define FMT_USE_RTTI 1 |
104 | | #else |
105 | | # define FMT_USE_RTTI 0 |
106 | | #endif |
107 | | |
108 | | // Visibility when compiled as a shared library/object. |
109 | | #if defined(FMT_LIB_EXPORT) || defined(FMT_SHARED) |
110 | | # define FMT_SO_VISIBILITY(value) FMT_VISIBILITY(value) |
111 | | #else |
112 | | # define FMT_SO_VISIBILITY(value) |
113 | | #endif |
114 | | |
115 | | #if FMT_GCC_VERSION || FMT_CLANG_VERSION |
116 | | # define FMT_NOINLINE __attribute__((noinline)) |
117 | | #else |
118 | | # define FMT_NOINLINE |
119 | | #endif |
120 | | |
121 | | namespace std { |
122 | | template <typename T> struct iterator_traits<fmt::basic_appender<T>> { |
123 | | using iterator_category = output_iterator_tag; |
124 | | using value_type = T; |
125 | | using difference_type = |
126 | | decltype(static_cast<int*>(nullptr) - static_cast<int*>(nullptr)); |
127 | | using pointer = void; |
128 | | using reference = void; |
129 | | }; |
130 | | } // namespace std |
131 | | |
132 | | #ifndef FMT_THROW |
133 | | # if FMT_USE_EXCEPTIONS |
134 | | # if FMT_MSC_VERSION || defined(__NVCC__) |
135 | | FMT_BEGIN_NAMESPACE |
136 | | namespace detail { |
137 | | template <typename Exception> inline void do_throw(const Exception& x) { |
138 | | // Silence unreachable code warnings in MSVC and NVCC because these |
139 | | // are nearly impossible to fix in a generic code. |
140 | | volatile bool b = true; |
141 | | if (b) throw x; |
142 | | } |
143 | | } // namespace detail |
144 | | FMT_END_NAMESPACE |
145 | | # define FMT_THROW(x) detail::do_throw(x) |
146 | | # else |
147 | 4.27k | # define FMT_THROW(x) throw x Unexecuted instantiation: fmt::v11::detail::fwrite_all(void const*, unsigned long, _IO_FILE*)::{lambda()#1}::operator()() const Unexecuted instantiation: fmt::v11::detail::fwrite_all(void const*, unsigned long, _IO_FILE*)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const |
148 | | # endif |
149 | | # else |
150 | | # define FMT_THROW(x) \ |
151 | | ::fmt::detail::assert_fail(__FILE__, __LINE__, (x).what()) |
152 | | # endif // FMT_USE_EXCEPTIONS |
153 | | #endif // FMT_THROW |
154 | | |
155 | | #ifdef FMT_NO_UNIQUE_ADDRESS |
156 | | // Use the provided definition. |
157 | | #elif FMT_CPLUSPLUS < 202002L |
158 | | // Not supported. |
159 | | #elif FMT_HAS_CPP_ATTRIBUTE(no_unique_address) |
160 | | # define FMT_NO_UNIQUE_ADDRESS [[no_unique_address]] |
161 | | // VS2019 v16.10 and later except clang-cl (https://reviews.llvm.org/D110485). |
162 | | #elif FMT_MSC_VERSION >= 1929 && !FMT_CLANG_VERSION |
163 | | # define FMT_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]] |
164 | | #endif |
165 | | #ifndef FMT_NO_UNIQUE_ADDRESS |
166 | | # define FMT_NO_UNIQUE_ADDRESS |
167 | | #endif |
168 | | |
169 | | // Defining FMT_REDUCE_INT_INSTANTIATIONS to 1, will reduce the number of |
170 | | // integer formatter template instantiations to just one by only using the |
171 | | // largest integer type. This results in a reduction in binary size but will |
172 | | // cause a decrease in integer formatting performance. |
173 | | #if !defined(FMT_REDUCE_INT_INSTANTIATIONS) |
174 | | # define FMT_REDUCE_INT_INSTANTIATIONS 0 |
175 | | #endif |
176 | | |
177 | | FMT_BEGIN_NAMESPACE |
178 | | |
179 | | template <typename Char, typename Traits, typename Allocator> |
180 | | struct is_contiguous<std::basic_string<Char, Traits, Allocator>> |
181 | | : std::true_type {}; |
182 | | |
183 | | namespace detail { |
184 | | |
185 | | // __builtin_clz is broken in clang with Microsoft codegen: |
186 | | // https://github.com/fmtlib/fmt/issues/519. |
187 | | #if !FMT_MSC_VERSION |
188 | | # if FMT_HAS_BUILTIN(__builtin_clz) || FMT_GCC_VERSION || FMT_ICC_VERSION |
189 | 4.09M | # define FMT_BUILTIN_CLZ(n) __builtin_clz(n) |
190 | | # endif |
191 | | # if FMT_HAS_BUILTIN(__builtin_clzll) || FMT_GCC_VERSION || FMT_ICC_VERSION |
192 | 995k | # define FMT_BUILTIN_CLZLL(n) __builtin_clzll(n) |
193 | | # endif |
194 | | #endif |
195 | | |
196 | | // Some compilers masquerade as both MSVC and GCC but otherwise support |
197 | | // __builtin_clz and __builtin_clzll, so only define FMT_BUILTIN_CLZ using the |
198 | | // MSVC intrinsics if the clz and clzll builtins are not available. |
199 | | #if FMT_MSC_VERSION && !defined(FMT_BUILTIN_CLZLL) |
200 | | // Avoid Clang with Microsoft CodeGen's -Wunknown-pragmas warning. |
201 | | # ifndef __clang__ |
202 | | # pragma intrinsic(_BitScanReverse) |
203 | | # ifdef _WIN64 |
204 | | # pragma intrinsic(_BitScanReverse64) |
205 | | # endif |
206 | | # endif |
207 | | |
208 | | inline auto clz(uint32_t x) -> int { |
209 | | FMT_ASSERT(x != 0, ""); |
210 | | FMT_MSC_WARNING(suppress : 6102) // Suppress a bogus static analysis warning. |
211 | | unsigned long r = 0; |
212 | | _BitScanReverse(&r, x); |
213 | | return 31 ^ static_cast<int>(r); |
214 | | } |
215 | | # define FMT_BUILTIN_CLZ(n) detail::clz(n) |
216 | | |
217 | | inline auto clzll(uint64_t x) -> int { |
218 | | FMT_ASSERT(x != 0, ""); |
219 | | FMT_MSC_WARNING(suppress : 6102) // Suppress a bogus static analysis warning. |
220 | | unsigned long r = 0; |
221 | | # ifdef _WIN64 |
222 | | _BitScanReverse64(&r, x); |
223 | | # else |
224 | | // Scan the high 32 bits. |
225 | | if (_BitScanReverse(&r, static_cast<uint32_t>(x >> 32))) |
226 | | return 63 ^ static_cast<int>(r + 32); |
227 | | // Scan the low 32 bits. |
228 | | _BitScanReverse(&r, static_cast<uint32_t>(x)); |
229 | | # endif |
230 | | return 63 ^ static_cast<int>(r); |
231 | | } |
232 | | # define FMT_BUILTIN_CLZLL(n) detail::clzll(n) |
233 | | #endif // FMT_MSC_VERSION && !defined(FMT_BUILTIN_CLZLL) |
234 | | |
235 | 527k | FMT_CONSTEXPR inline void abort_fuzzing_if(bool condition) { |
236 | 527k | ignore_unused(condition); |
237 | 527k | #ifdef FMT_FUZZ |
238 | 527k | if (condition) throw std::runtime_error("fuzzing limit reached"); |
239 | 527k | #endif |
240 | 527k | } |
241 | | |
242 | | #if defined(FMT_USE_STRING_VIEW) |
243 | | template <typename Char> using std_string_view = std::basic_string_view<Char>; |
244 | | #else |
245 | | template <typename T> struct std_string_view {}; |
246 | | #endif |
247 | | |
248 | | template <typename Char, Char... C> struct string_literal { |
249 | | static constexpr Char value[sizeof...(C)] = {C...}; |
250 | 8.97k | constexpr operator basic_string_view<Char>() const { |
251 | 8.97k | return {value, sizeof...(C)}; |
252 | 8.97k | } |
253 | | }; |
254 | | #if FMT_CPLUSPLUS < 201703L |
255 | | template <typename Char, Char... C> |
256 | | constexpr Char string_literal<Char, C...>::value[sizeof...(C)]; |
257 | | #endif |
258 | | |
259 | | // Implementation of std::bit_cast for pre-C++20. |
260 | | template <typename To, typename From, FMT_ENABLE_IF(sizeof(To) == sizeof(From))> |
261 | 483k | FMT_CONSTEXPR20 auto bit_cast(const From& from) -> To { |
262 | | #ifdef __cpp_lib_bit_cast |
263 | | if (is_constant_evaluated()) return std::bit_cast<To>(from); |
264 | | #endif |
265 | 483k | auto to = To(); |
266 | | // The cast suppresses a bogus -Wclass-memaccess on GCC. |
267 | 483k | std::memcpy(static_cast<void*>(&to), &from, sizeof(to)); |
268 | 483k | return to; |
269 | 483k | } _ZN3fmt3v116detail8bit_castIjfTnNSt3__19enable_ifIXeqstT_stT0_EiE4typeELi0EEES5_RKS6_ Line | Count | Source | 261 | 57.7k | FMT_CONSTEXPR20 auto bit_cast(const From& from) -> To { | 262 | | #ifdef __cpp_lib_bit_cast | 263 | | if (is_constant_evaluated()) return std::bit_cast<To>(from); | 264 | | #endif | 265 | 57.7k | auto to = To(); | 266 | | // The cast suppresses a bogus -Wclass-memaccess on GCC. | 267 | 57.7k | std::memcpy(static_cast<void*>(&to), &from, sizeof(to)); | 268 | 57.7k | return to; | 269 | 57.7k | } |
_ZN3fmt3v116detail8bit_castIoeTnNSt3__19enable_ifIXeqstT_stT0_EiE4typeELi0EEES5_RKS6_ Line | Count | Source | 261 | 199k | FMT_CONSTEXPR20 auto bit_cast(const From& from) -> To { | 262 | | #ifdef __cpp_lib_bit_cast | 263 | | if (is_constant_evaluated()) return std::bit_cast<To>(from); | 264 | | #endif | 265 | 199k | auto to = To(); | 266 | | // The cast suppresses a bogus -Wclass-memaccess on GCC. | 267 | 199k | std::memcpy(static_cast<void*>(&to), &from, sizeof(to)); | 268 | 199k | return to; | 269 | 199k | } |
_ZN3fmt3v116detail8bit_castImPKvTnNSt3__19enable_ifIXeqstT_stT0_EiE4typeELi0EEES7_RKS8_ Line | Count | Source | 261 | 2.17k | FMT_CONSTEXPR20 auto bit_cast(const From& from) -> To { | 262 | | #ifdef __cpp_lib_bit_cast | 263 | | if (is_constant_evaluated()) return std::bit_cast<To>(from); | 264 | | #endif | 265 | 2.17k | auto to = To(); | 266 | | // The cast suppresses a bogus -Wclass-memaccess on GCC. | 267 | 2.17k | std::memcpy(static_cast<void*>(&to), &from, sizeof(to)); | 268 | 2.17k | return to; | 269 | 2.17k | } |
Unexecuted instantiation: _ZN3fmt3v116detail8bit_castImPKcTnNSt3__19enable_ifIXeqstT_stT0_EiE4typeELi0EEES7_RKS8_ _ZN3fmt3v116detail8bit_castImdTnNSt3__19enable_ifIXeqstT_stT0_EiE4typeELi0EEES5_RKS6_ Line | Count | Source | 261 | 223k | FMT_CONSTEXPR20 auto bit_cast(const From& from) -> To { | 262 | | #ifdef __cpp_lib_bit_cast | 263 | | if (is_constant_evaluated()) return std::bit_cast<To>(from); | 264 | | #endif | 265 | 223k | auto to = To(); | 266 | | // The cast suppresses a bogus -Wclass-memaccess on GCC. | 267 | 223k | std::memcpy(static_cast<void*>(&to), &from, sizeof(to)); | 268 | 223k | return to; | 269 | 223k | } |
|
270 | | |
271 | 307k | inline auto is_big_endian() -> bool { |
272 | | #ifdef _WIN32 |
273 | | return false; |
274 | | #elif defined(__BIG_ENDIAN__) |
275 | | return true; |
276 | | #elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) |
277 | | return __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__; |
278 | | #else |
279 | | struct bytes { |
280 | | char data[sizeof(int)]; |
281 | | }; |
282 | | return bit_cast<bytes>(1).data[0] == 0; |
283 | | #endif |
284 | 307k | } |
285 | | |
286 | | class uint128_fallback { |
287 | | private: |
288 | | uint64_t lo_, hi_; |
289 | | |
290 | | public: |
291 | 907k | constexpr uint128_fallback(uint64_t hi, uint64_t lo) : lo_(lo), hi_(hi) {} |
292 | 0 | constexpr uint128_fallback(uint64_t value = 0) : lo_(value), hi_(0) {} |
293 | | |
294 | 1.15M | constexpr auto high() const noexcept -> uint64_t { return hi_; } |
295 | 1.42M | constexpr auto low() const noexcept -> uint64_t { return lo_; } |
296 | | |
297 | | template <typename T, FMT_ENABLE_IF(std::is_integral<T>::value)> |
298 | | constexpr explicit operator T() const { |
299 | | return static_cast<T>(lo_); |
300 | | } |
301 | | |
302 | | friend constexpr auto operator==(const uint128_fallback& lhs, |
303 | 0 | const uint128_fallback& rhs) -> bool { |
304 | 0 | return lhs.hi_ == rhs.hi_ && lhs.lo_ == rhs.lo_; |
305 | 0 | } |
306 | | friend constexpr auto operator!=(const uint128_fallback& lhs, |
307 | 0 | const uint128_fallback& rhs) -> bool { |
308 | 0 | return !(lhs == rhs); |
309 | 0 | } |
310 | | friend constexpr auto operator>(const uint128_fallback& lhs, |
311 | 0 | const uint128_fallback& rhs) -> bool { |
312 | 0 | return lhs.hi_ != rhs.hi_ ? lhs.hi_ > rhs.hi_ : lhs.lo_ > rhs.lo_; |
313 | 0 | } |
314 | | friend constexpr auto operator|(const uint128_fallback& lhs, |
315 | | const uint128_fallback& rhs) |
316 | 0 | -> uint128_fallback { |
317 | 0 | return {lhs.hi_ | rhs.hi_, lhs.lo_ | rhs.lo_}; |
318 | 0 | } |
319 | | friend constexpr auto operator&(const uint128_fallback& lhs, |
320 | | const uint128_fallback& rhs) |
321 | 0 | -> uint128_fallback { |
322 | 0 | return {lhs.hi_ & rhs.hi_, lhs.lo_ & rhs.lo_}; |
323 | 0 | } |
324 | | friend constexpr auto operator~(const uint128_fallback& n) |
325 | 0 | -> uint128_fallback { |
326 | 0 | return {~n.hi_, ~n.lo_}; |
327 | 0 | } |
328 | | friend FMT_CONSTEXPR auto operator+(const uint128_fallback& lhs, |
329 | | const uint128_fallback& rhs) |
330 | 0 | -> uint128_fallback { |
331 | 0 | auto result = uint128_fallback(lhs); |
332 | 0 | result += rhs; |
333 | 0 | return result; |
334 | 0 | } |
335 | | friend FMT_CONSTEXPR auto operator*(const uint128_fallback& lhs, uint32_t rhs) |
336 | 0 | -> uint128_fallback { |
337 | 0 | FMT_ASSERT(lhs.hi_ == 0, ""); |
338 | 0 | uint64_t hi = (lhs.lo_ >> 32) * rhs; |
339 | 0 | uint64_t lo = (lhs.lo_ & ~uint32_t()) * rhs; |
340 | 0 | uint64_t new_lo = (hi << 32) + lo; |
341 | 0 | return {(hi >> 32) + (new_lo < lo ? 1 : 0), new_lo}; |
342 | 0 | } |
343 | | friend constexpr auto operator-(const uint128_fallback& lhs, uint64_t rhs) |
344 | 0 | -> uint128_fallback { |
345 | 0 | return {lhs.hi_ - (lhs.lo_ < rhs ? 1 : 0), lhs.lo_ - rhs}; |
346 | 0 | } |
347 | 0 | FMT_CONSTEXPR auto operator>>(int shift) const -> uint128_fallback { |
348 | 0 | if (shift == 64) return {0, hi_}; |
349 | 0 | if (shift > 64) return uint128_fallback(0, hi_) >> (shift - 64); |
350 | 0 | return {hi_ >> shift, (hi_ << (64 - shift)) | (lo_ >> shift)}; |
351 | 0 | } |
352 | 0 | FMT_CONSTEXPR auto operator<<(int shift) const -> uint128_fallback { |
353 | 0 | if (shift == 64) return {lo_, 0}; |
354 | 0 | if (shift > 64) return uint128_fallback(lo_, 0) << (shift - 64); |
355 | 0 | return {hi_ << shift | (lo_ >> (64 - shift)), (lo_ << shift)}; |
356 | 0 | } |
357 | 0 | FMT_CONSTEXPR auto operator>>=(int shift) -> uint128_fallback& { |
358 | 0 | return *this = *this >> shift; |
359 | 0 | } |
360 | 0 | FMT_CONSTEXPR void operator+=(uint128_fallback n) { |
361 | 0 | uint64_t new_lo = lo_ + n.lo_; |
362 | 0 | uint64_t new_hi = hi_ + n.hi_ + (new_lo < lo_ ? 1 : 0); |
363 | 0 | FMT_ASSERT(new_hi >= hi_, ""); |
364 | 0 | lo_ = new_lo; |
365 | 0 | hi_ = new_hi; |
366 | 0 | } |
367 | 0 | FMT_CONSTEXPR void operator&=(uint128_fallback n) { |
368 | 0 | lo_ &= n.lo_; |
369 | 0 | hi_ &= n.hi_; |
370 | 0 | } |
371 | | |
372 | 350k | FMT_CONSTEXPR20 auto operator+=(uint64_t n) noexcept -> uint128_fallback& { |
373 | 350k | if (is_constant_evaluated()) { |
374 | 0 | lo_ += n; |
375 | 0 | hi_ += (lo_ < n ? 1 : 0); |
376 | 0 | return *this; |
377 | 0 | } |
378 | 350k | #if FMT_HAS_BUILTIN(__builtin_addcll) && !defined(__ibmxl__) |
379 | 350k | unsigned long long carry; |
380 | 350k | lo_ = __builtin_addcll(lo_, n, 0, &carry); |
381 | 350k | hi_ += carry; |
382 | | #elif FMT_HAS_BUILTIN(__builtin_ia32_addcarryx_u64) && !defined(__ibmxl__) |
383 | | unsigned long long result; |
384 | | auto carry = __builtin_ia32_addcarryx_u64(0, lo_, n, &result); |
385 | | lo_ = result; |
386 | | hi_ += carry; |
387 | | #elif defined(_MSC_VER) && defined(_M_X64) |
388 | | auto carry = _addcarry_u64(0, lo_, n, &lo_); |
389 | | _addcarry_u64(carry, hi_, 0, &hi_); |
390 | | #else |
391 | | lo_ += n; |
392 | | hi_ += (lo_ < n ? 1 : 0); |
393 | | #endif |
394 | 350k | return *this; |
395 | 350k | } |
396 | | }; |
397 | | |
398 | | using uint128_t = conditional_t<FMT_USE_INT128, uint128_opt, uint128_fallback>; |
399 | | |
400 | | #ifdef UINTPTR_MAX |
401 | | using uintptr_t = ::uintptr_t; |
402 | | #else |
403 | | using uintptr_t = uint128_t; |
404 | | #endif |
405 | | |
406 | | // Returns the largest possible value for type T. Same as |
407 | | // std::numeric_limits<T>::max() but shorter and not affected by the max macro. |
408 | 3.14M | template <typename T> constexpr auto max_value() -> T { |
409 | 3.14M | return (std::numeric_limits<T>::max)(); |
410 | 3.14M | } unsigned long fmt::v11::detail::max_value<unsigned long>() Line | Count | Source | 408 | 509k | template <typename T> constexpr auto max_value() -> T { | 409 | 509k | return (std::numeric_limits<T>::max)(); | 410 | 509k | } |
int fmt::v11::detail::max_value<int>() Line | Count | Source | 408 | 2.17M | template <typename T> constexpr auto max_value() -> T { | 409 | 2.17M | return (std::numeric_limits<T>::max)(); | 410 | 2.17M | } |
Unexecuted instantiation: char fmt::v11::detail::max_value<char>() unsigned int fmt::v11::detail::max_value<unsigned int>() Line | Count | Source | 408 | 164k | template <typename T> constexpr auto max_value() -> T { | 409 | 164k | return (std::numeric_limits<T>::max)(); | 410 | 164k | } |
long long fmt::v11::detail::max_value<long long>() Line | Count | Source | 408 | 220k | template <typename T> constexpr auto max_value() -> T { | 409 | 220k | return (std::numeric_limits<T>::max)(); | 410 | 220k | } |
long fmt::v11::detail::max_value<long>() Line | Count | Source | 408 | 43.6k | template <typename T> constexpr auto max_value() -> T { | 409 | 43.6k | return (std::numeric_limits<T>::max)(); | 410 | 43.6k | } |
unsigned long long fmt::v11::detail::max_value<unsigned long long>() Line | Count | Source | 408 | 36.7k | template <typename T> constexpr auto max_value() -> T { | 409 | 36.7k | return (std::numeric_limits<T>::max)(); | 410 | 36.7k | } |
Unexecuted instantiation: float fmt::v11::detail::max_value<float>() Unexecuted instantiation: double fmt::v11::detail::max_value<double>() Unexecuted instantiation: long double fmt::v11::detail::max_value<long double>() |
411 | 34.7M | template <typename T> constexpr auto num_bits() -> int { |
412 | 34.7M | return std::numeric_limits<T>::digits; |
413 | 34.7M | } int fmt::v11::detail::num_bits<unsigned int>() Line | Count | Source | 411 | 34.6M | template <typename T> constexpr auto num_bits() -> int { | 412 | 34.6M | return std::numeric_limits<T>::digits; | 413 | 34.6M | } |
Unexecuted instantiation: int fmt::v11::detail::num_bits<unsigned char>() Unexecuted instantiation: int fmt::v11::detail::num_bits<double>() Unexecuted instantiation: int fmt::v11::detail::num_bits<int>() int fmt::v11::detail::num_bits<unsigned long>() Line | Count | Source | 411 | 92.2k | template <typename T> constexpr auto num_bits() -> int { | 412 | 92.2k | return std::numeric_limits<T>::digits; | 413 | 92.2k | } |
Unexecuted instantiation: int fmt::v11::detail::num_bits<unsigned long long>() Unexecuted instantiation: int fmt::v11::detail::num_bits<long>() Unexecuted instantiation: int fmt::v11::detail::num_bits<long long>() Unexecuted instantiation: int fmt::v11::detail::num_bits<float>() Unexecuted instantiation: int fmt::v11::detail::num_bits<long double>() Unexecuted instantiation: int fmt::v11::detail::num_bits<signed char>() Unexecuted instantiation: int fmt::v11::detail::num_bits<short>() Unexecuted instantiation: int fmt::v11::detail::num_bits<unsigned short>() |
414 | | // std::numeric_limits<T>::digits may return 0 for 128-bit ints. |
415 | 0 | template <> constexpr auto num_bits<int128_opt>() -> int { return 128; } |
416 | 0 | template <> constexpr auto num_bits<uint128_opt>() -> int { return 128; } |
417 | 0 | template <> constexpr auto num_bits<uint128_fallback>() -> int { return 128; } |
418 | | |
419 | | // A heterogeneous bit_cast used for converting 96-bit long double to uint128_t |
420 | | // and 128-bit pointers to uint128_fallback. |
421 | | template <typename To, typename From, FMT_ENABLE_IF(sizeof(To) > sizeof(From))> |
422 | | inline auto bit_cast(const From& from) -> To { |
423 | | constexpr auto size = static_cast<int>(sizeof(From) / sizeof(unsigned)); |
424 | | struct data_t { |
425 | | unsigned value[static_cast<unsigned>(size)]; |
426 | | } data = bit_cast<data_t>(from); |
427 | | auto result = To(); |
428 | | if (const_check(is_big_endian())) { |
429 | | for (int i = 0; i < size; ++i) |
430 | | result = (result << num_bits<unsigned>()) | data.value[i]; |
431 | | } else { |
432 | | for (int i = size - 1; i >= 0; --i) |
433 | | result = (result << num_bits<unsigned>()) | data.value[i]; |
434 | | } |
435 | | return result; |
436 | | } |
437 | | |
438 | | template <typename UInt> |
439 | 0 | FMT_CONSTEXPR20 inline auto countl_zero_fallback(UInt n) -> int { |
440 | 0 | int lz = 0; |
441 | 0 | constexpr UInt msb_mask = static_cast<UInt>(1) << (num_bits<UInt>() - 1); |
442 | 0 | for (; (n & msb_mask) == 0; n <<= 1) lz++; |
443 | 0 | return lz; |
444 | 0 | } Unexecuted instantiation: int fmt::v11::detail::countl_zero_fallback<unsigned int>(unsigned int) Unexecuted instantiation: int fmt::v11::detail::countl_zero_fallback<unsigned long>(unsigned long) |
445 | | |
446 | 109k | FMT_CONSTEXPR20 inline auto countl_zero(uint32_t n) -> int { |
447 | 109k | #ifdef FMT_BUILTIN_CLZ |
448 | 109k | if (!is_constant_evaluated()) return FMT_BUILTIN_CLZ(n); |
449 | 0 | #endif |
450 | 0 | return countl_zero_fallback(n); |
451 | 109k | } |
452 | | |
453 | 13.2k | FMT_CONSTEXPR20 inline auto countl_zero(uint64_t n) -> int { |
454 | 13.2k | #ifdef FMT_BUILTIN_CLZLL |
455 | 13.2k | if (!is_constant_evaluated()) return FMT_BUILTIN_CLZLL(n); |
456 | 0 | #endif |
457 | 0 | return countl_zero_fallback(n); |
458 | 13.2k | } |
459 | | |
460 | 465k | FMT_INLINE void assume(bool condition) { |
461 | 465k | (void)condition; |
462 | 465k | #if FMT_HAS_BUILTIN(__builtin_assume) && !FMT_ICC_VERSION |
463 | 465k | __builtin_assume(condition); |
464 | | #elif FMT_GCC_VERSION |
465 | | if (!condition) __builtin_unreachable(); |
466 | | #endif |
467 | 465k | } |
468 | | |
469 | | // Attempts to reserve space for n extra characters in the output range. |
470 | | // Returns a pointer to the reserved range or a reference to it. |
471 | | template <typename OutputIt, |
472 | | FMT_ENABLE_IF(is_back_insert_iterator<OutputIt>::value&& |
473 | | is_contiguous<typename OutputIt::container>::value)> |
474 | | #if FMT_CLANG_VERSION >= 307 && !FMT_ICC_VERSION |
475 | | __attribute__((no_sanitize("undefined"))) |
476 | | #endif |
477 | | FMT_CONSTEXPR20 inline auto |
478 | | reserve(OutputIt it, size_t n) -> typename OutputIt::value_type* { |
479 | | auto& c = get_container(it); |
480 | | size_t size = c.size(); |
481 | | c.resize(size + n); |
482 | | return &c[size]; |
483 | | } |
484 | | |
485 | | template <typename T> |
486 | | FMT_CONSTEXPR20 inline auto reserve(basic_appender<T> it, size_t n) |
487 | 811k | -> basic_appender<T> { |
488 | 811k | buffer<T>& buf = get_container(it); |
489 | 811k | buf.try_reserve(buf.size() + n); |
490 | 811k | return it; |
491 | 811k | } |
492 | | |
493 | | template <typename Iterator> |
494 | | constexpr auto reserve(Iterator& it, size_t) -> Iterator& { |
495 | | return it; |
496 | | } |
497 | | |
498 | | template <typename OutputIt> |
499 | | using reserve_iterator = |
500 | | remove_reference_t<decltype(reserve(std::declval<OutputIt&>(), 0))>; |
501 | | |
502 | | template <typename T, typename OutputIt> |
503 | | constexpr auto to_pointer(OutputIt, size_t) -> T* { |
504 | | return nullptr; |
505 | | } |
506 | | template <typename T> |
507 | 2.34M | FMT_CONSTEXPR20 auto to_pointer(basic_appender<T> it, size_t n) -> T* { |
508 | 2.34M | buffer<T>& buf = get_container(it); |
509 | 2.34M | auto size = buf.size(); |
510 | 2.34M | buf.try_reserve(size + n); |
511 | 2.34M | if (buf.capacity() < size + n) return nullptr; |
512 | 2.34M | buf.try_resize(size + n); |
513 | 2.34M | return buf.data() + size; |
514 | 2.34M | } |
515 | | |
516 | | template <typename OutputIt, |
517 | | FMT_ENABLE_IF(is_back_insert_iterator<OutputIt>::value&& |
518 | | is_contiguous<typename OutputIt::container>::value)> |
519 | | inline auto base_iterator(OutputIt it, |
520 | | typename OutputIt::container_type::value_type*) |
521 | | -> OutputIt { |
522 | | return it; |
523 | | } |
524 | | |
525 | | template <typename Iterator> |
526 | 805k | constexpr auto base_iterator(Iterator, Iterator it) -> Iterator { |
527 | 805k | return it; |
528 | 805k | } |
529 | | |
530 | | // <algorithm> is spectacularly slow to compile in C++20 so use a simple fill_n |
531 | | // instead (#1998). |
532 | | template <typename OutputIt, typename Size, typename T> |
533 | | FMT_CONSTEXPR auto fill_n(OutputIt out, Size count, const T& value) |
534 | 1.98M | -> OutputIt { |
535 | 28.3M | for (Size i = 0; i < count; ++i) *out++ = value; |
536 | 1.98M | return out; |
537 | 1.98M | } Unexecuted instantiation: int* fmt::v11::detail::fill_n<int*, unsigned long, int>(int*, unsigned long, int const&) fmt::v11::basic_appender<char> fmt::v11::detail::fill_n<fmt::v11::basic_appender<char>, int, char>(fmt::v11::basic_appender<char>, int, char const&) Line | Count | Source | 534 | 1.91M | -> OutputIt { | 535 | 17.1M | for (Size i = 0; i < count; ++i) *out++ = value; | 536 | 1.91M | return out; | 537 | 1.91M | } |
Unexecuted instantiation: unsigned int* fmt::v11::detail::fill_n<unsigned int*, unsigned long, unsigned int>(unsigned int*, unsigned long, unsigned int const&) Unexecuted instantiation: char* fmt::v11::detail::fill_n<char*, unsigned long, char>(char*, unsigned long, char const&) fmt::v11::basic_appender<char> fmt::v11::detail::fill_n<fmt::v11::basic_appender<char>, unsigned long, char>(fmt::v11::basic_appender<char>, unsigned long, char const&) Line | Count | Source | 534 | 52.5k | -> OutputIt { | 535 | 10.7M | for (Size i = 0; i < count; ++i) *out++ = value; | 536 | 52.5k | return out; | 537 | 52.5k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::fill_n<fmt::v11::basic_appender<char>, unsigned int, char>(fmt::v11::basic_appender<char>, unsigned int, char const&) Line | Count | Source | 534 | 16.4k | -> OutputIt { | 535 | 353k | for (Size i = 0; i < count; ++i) *out++ = value; | 536 | 16.4k | return out; | 537 | 16.4k | } |
Unexecuted instantiation: wchar_t* fmt::v11::detail::fill_n<wchar_t*, unsigned long, wchar_t>(wchar_t*, unsigned long, wchar_t const&) Unexecuted instantiation: char* fmt::v11::detail::fill_n<char*, int, char>(char*, int, char const&) |
538 | | template <typename T, typename Size> |
539 | 34.9k | FMT_CONSTEXPR20 auto fill_n(T* out, Size count, char value) -> T* { |
540 | 34.9k | if (is_constant_evaluated()) return fill_n<T*, Size, T>(out, count, value); |
541 | 34.9k | std::memset(out, value, to_unsigned(count)); |
542 | 34.9k | return out + count; |
543 | 34.9k | } char* fmt::v11::detail::fill_n<char, unsigned long>(char*, unsigned long, char) Line | Count | Source | 539 | 17.8k | FMT_CONSTEXPR20 auto fill_n(T* out, Size count, char value) -> T* { | 540 | 17.8k | if (is_constant_evaluated()) return fill_n<T*, Size, T>(out, count, value); | 541 | 17.8k | std::memset(out, value, to_unsigned(count)); | 542 | 17.8k | return out + count; | 543 | 17.8k | } |
char* fmt::v11::detail::fill_n<char, int>(char*, int, char) Line | Count | Source | 539 | 17.0k | FMT_CONSTEXPR20 auto fill_n(T* out, Size count, char value) -> T* { | 540 | 17.0k | if (is_constant_evaluated()) return fill_n<T*, Size, T>(out, count, value); | 541 | 17.0k | std::memset(out, value, to_unsigned(count)); | 542 | 17.0k | return out + count; | 543 | 17.0k | } |
|
544 | | |
545 | | template <typename OutChar, typename InputIt, typename OutputIt> |
546 | | FMT_CONSTEXPR FMT_NOINLINE auto copy_noinline(InputIt begin, InputIt end, |
547 | 1.38M | OutputIt out) -> OutputIt { |
548 | 1.38M | return copy<OutChar>(begin, end, out); |
549 | 1.38M | } fmt::v11::basic_appender<char> fmt::v11::detail::copy_noinline<char, char*, fmt::v11::basic_appender<char> >(char*, char*, fmt::v11::basic_appender<char>) Line | Count | Source | 547 | 41.6k | OutputIt out) -> OutputIt { | 548 | 41.6k | return copy<OutChar>(begin, end, out); | 549 | 41.6k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::copy_noinline<char, char const*, fmt::v11::basic_appender<char> >(char const*, char const*, fmt::v11::basic_appender<char>) Line | Count | Source | 547 | 1.34M | OutputIt out) -> OutputIt { | 548 | 1.34M | return copy<OutChar>(begin, end, out); | 549 | 1.34M | } |
|
550 | | |
551 | | // A public domain branchless UTF-8 decoder by Christopher Wellons: |
552 | | // https://github.com/skeeto/branchless-utf8 |
553 | | /* Decode the next character, c, from s, reporting errors in e. |
554 | | * |
555 | | * Since this is a branchless decoder, four bytes will be read from the |
556 | | * buffer regardless of the actual length of the next character. This |
557 | | * means the buffer _must_ have at least three bytes of zero padding |
558 | | * following the end of the data stream. |
559 | | * |
560 | | * Errors are reported in e, which will be non-zero if the parsed |
561 | | * character was somehow invalid: invalid byte sequence, non-canonical |
562 | | * encoding, or a surrogate half. |
563 | | * |
564 | | * The function returns a pointer to the next character. When an error |
565 | | * occurs, this pointer will be a guess that depends on the particular |
566 | | * error, but it will always advance at least one byte. |
567 | | */ |
568 | | FMT_CONSTEXPR inline auto utf8_decode(const char* s, uint32_t* c, int* e) |
569 | 5.16M | -> const char* { |
570 | 5.16M | constexpr const int masks[] = {0x00, 0x7f, 0x1f, 0x0f, 0x07}; |
571 | 5.16M | constexpr const uint32_t mins[] = {4194304, 0, 128, 2048, 65536}; |
572 | 5.16M | constexpr const int shiftc[] = {0, 18, 12, 6, 0}; |
573 | 5.16M | constexpr const int shifte[] = {0, 6, 4, 2, 0}; |
574 | | |
575 | 5.16M | int len = "\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\0\0\0\0\0\0\0\0\2\2\2\2\3\3\4" |
576 | 5.16M | [static_cast<unsigned char>(*s) >> 3]; |
577 | | // Compute the pointer to the next character early so that the next |
578 | | // iteration can start working on the next character. Neither Clang |
579 | | // nor GCC figure out this reordering on their own. |
580 | 5.16M | const char* next = s + len + !len; |
581 | | |
582 | 5.16M | using uchar = unsigned char; |
583 | | |
584 | | // Assume a four-byte character and load four bytes. Unused bits are |
585 | | // shifted out. |
586 | 5.16M | *c = uint32_t(uchar(s[0]) & masks[len]) << 18; |
587 | 5.16M | *c |= uint32_t(uchar(s[1]) & 0x3f) << 12; |
588 | 5.16M | *c |= uint32_t(uchar(s[2]) & 0x3f) << 6; |
589 | 5.16M | *c |= uint32_t(uchar(s[3]) & 0x3f) << 0; |
590 | 5.16M | *c >>= shiftc[len]; |
591 | | |
592 | | // Accumulate the various error conditions. |
593 | 5.16M | *e = (*c < mins[len]) << 6; // non-canonical encoding |
594 | 5.16M | *e |= ((*c >> 11) == 0x1b) << 7; // surrogate half? |
595 | 5.16M | *e |= (*c > 0x10FFFF) << 8; // out of range? |
596 | 5.16M | *e |= (uchar(s[1]) & 0xc0) >> 2; |
597 | 5.16M | *e |= (uchar(s[2]) & 0xc0) >> 4; |
598 | 5.16M | *e |= uchar(s[3]) >> 6; |
599 | 5.16M | *e ^= 0x2a; // top two bits of each tail byte correct? |
600 | 5.16M | *e >>= shifte[len]; |
601 | | |
602 | 5.16M | return next; |
603 | 5.16M | } |
604 | | |
605 | | constexpr FMT_INLINE_VARIABLE uint32_t invalid_code_point = ~uint32_t(); |
606 | | |
607 | | // Invokes f(cp, sv) for every code point cp in s with sv being the string view |
608 | | // corresponding to the code point. cp is invalid_code_point on error. |
609 | | template <typename F> |
610 | 43.6k | FMT_CONSTEXPR void for_each_codepoint(string_view s, F f) { |
611 | 5.16M | auto decode = [f](const char* buf_ptr, const char* ptr) { |
612 | 5.16M | auto cp = uint32_t(); |
613 | 5.16M | auto error = 0; |
614 | 5.16M | auto end = utf8_decode(buf_ptr, &cp, &error); |
615 | 5.16M | bool result = f(error ? invalid_code_point : cp, |
616 | 5.16M | string_view(ptr, error ? 1 : to_unsigned(end - buf_ptr))); |
617 | 5.16M | return result ? (error ? buf_ptr + 1 : end) : nullptr; |
618 | 5.16M | }; Unexecuted instantiation: format.cc:fmt::v11::detail::for_each_codepoint<fmt::v11::detail::utf8_to_utf16::utf8_to_utf16(fmt::v11::basic_string_view<char>)::$_0>(fmt::v11::basic_string_view<char>, fmt::v11::detail::utf8_to_utf16::utf8_to_utf16(fmt::v11::basic_string_view<char>)::$_0)::{lambda(char const*, char const*)#1}::operator()(char const*, char const*) const Unexecuted instantiation: fmt::v11::detail::for_each_codepoint<fmt::v11::detail::code_point_index(fmt::v11::basic_string_view<char>, unsigned long)::{lambda(unsigned int, fmt::v11::basic_string_view<char>)#1}>(fmt::v11::basic_string_view<char>, fmt::v11::detail::code_point_index(fmt::v11::basic_string_view<char>, unsigned long)::{lambda(unsigned int, fmt::v11::basic_string_view<char>)#1})::{lambda(char const*, char const)#1}::operator()(char const, char const) const Unexecuted instantiation: fmt::v11::detail::for_each_codepoint<fmt::v11::detail::find_escape(char const*, char const*)::{lambda(unsigned int, fmt::v11::basic_string_view<char>)#1}>(fmt::v11::basic_string_view<char>, fmt::v11::detail::find_escape(char const*, char const*)::{lambda(unsigned int, fmt::v11::basic_string_view<char>)#1})::{lambda(char const*, char const*)#1}::operator()(char const*, char const*) const fmt::v11::detail::for_each_codepoint<fmt::v11::detail::compute_width(fmt::v11::basic_string_view<char>)::count_code_points>(fmt::v11::basic_string_view<char>, fmt::v11::detail::compute_width(fmt::v11::basic_string_view<char>)::count_code_points)::{lambda(char const*, char const*)#1}::operator()(char const*, char const*) const Line | Count | Source | 611 | 5.16M | auto decode = [f](const char* buf_ptr, const char* ptr) { | 612 | 5.16M | auto cp = uint32_t(); | 613 | 5.16M | auto error = 0; | 614 | 5.16M | auto end = utf8_decode(buf_ptr, &cp, &error); | 615 | 5.16M | bool result = f(error ? invalid_code_point : cp, | 616 | 5.16M | string_view(ptr, error ? 1 : to_unsigned(end - buf_ptr))); | 617 | 5.16M | return result ? (error ? buf_ptr + 1 : end) : nullptr; | 618 | 5.16M | }; |
|
619 | | |
620 | 43.6k | auto p = s.data(); |
621 | 43.6k | const size_t block_size = 4; // utf8_decode always reads blocks of 4 chars. |
622 | 43.6k | if (s.size() >= block_size) { |
623 | 5.08M | for (auto end = p + s.size() - block_size + 1; p < end;) { |
624 | 5.03M | p = decode(p, p); |
625 | 5.03M | if (!p) return; |
626 | 5.03M | } |
627 | 42.0k | } |
628 | 43.6k | auto num_chars_left = to_unsigned(s.data() + s.size() - p); |
629 | 43.6k | if (num_chars_left == 0) return; |
630 | | |
631 | | // Suppress bogus -Wstringop-overflow. |
632 | 42.7k | if (FMT_GCC_VERSION) num_chars_left &= 3; |
633 | 42.7k | char buf[2 * block_size - 1] = {}; |
634 | 42.7k | copy<char>(p, p + num_chars_left, buf); |
635 | 42.7k | const char* buf_ptr = buf; |
636 | 126k | do { |
637 | 126k | auto end = decode(buf_ptr, p); |
638 | 126k | if (!end) return; |
639 | 126k | p += end - buf_ptr; |
640 | 126k | buf_ptr = end; |
641 | 126k | } while (buf_ptr < buf + num_chars_left); |
642 | 42.7k | } void fmt::v11::detail::for_each_codepoint<fmt::v11::detail::compute_width(fmt::v11::basic_string_view<char>)::count_code_points>(fmt::v11::basic_string_view<char>, fmt::v11::detail::compute_width(fmt::v11::basic_string_view<char>)::count_code_points) Line | Count | Source | 610 | 43.6k | FMT_CONSTEXPR void for_each_codepoint(string_view s, F f) { | 611 | 43.6k | auto decode = [f](const char* buf_ptr, const char* ptr) { | 612 | 43.6k | auto cp = uint32_t(); | 613 | 43.6k | auto error = 0; | 614 | 43.6k | auto end = utf8_decode(buf_ptr, &cp, &error); | 615 | 43.6k | bool result = f(error ? invalid_code_point : cp, | 616 | 43.6k | string_view(ptr, error ? 1 : to_unsigned(end - buf_ptr))); | 617 | 43.6k | return result ? (error ? buf_ptr + 1 : end) : nullptr; | 618 | 43.6k | }; | 619 | | | 620 | 43.6k | auto p = s.data(); | 621 | 43.6k | const size_t block_size = 4; // utf8_decode always reads blocks of 4 chars. | 622 | 43.6k | if (s.size() >= block_size) { | 623 | 5.08M | for (auto end = p + s.size() - block_size + 1; p < end;) { | 624 | 5.03M | p = decode(p, p); | 625 | 5.03M | if (!p) return; | 626 | 5.03M | } | 627 | 42.0k | } | 628 | 43.6k | auto num_chars_left = to_unsigned(s.data() + s.size() - p); | 629 | 43.6k | if (num_chars_left == 0) return; | 630 | | | 631 | | // Suppress bogus -Wstringop-overflow. | 632 | 42.7k | if (FMT_GCC_VERSION) num_chars_left &= 3; | 633 | 42.7k | char buf[2 * block_size - 1] = {}; | 634 | 42.7k | copy<char>(p, p + num_chars_left, buf); | 635 | 42.7k | const char* buf_ptr = buf; | 636 | 126k | do { | 637 | 126k | auto end = decode(buf_ptr, p); | 638 | 126k | if (!end) return; | 639 | 126k | p += end - buf_ptr; | 640 | 126k | buf_ptr = end; | 641 | 126k | } while (buf_ptr < buf + num_chars_left); | 642 | 42.7k | } |
Unexecuted instantiation: void fmt::v11::detail::for_each_codepoint<fmt::v11::detail::code_point_index(fmt::v11::basic_string_view<char>, unsigned long)::{lambda(unsigned int, fmt::v11::basic_string_view<char>)#1}>(fmt::v11::basic_string_view<char>, fmt::v11::detail::code_point_index(fmt::v11::basic_string_view<char>, unsigned long)::{lambda(unsigned int, fmt::v11::basic_string_view<char>)#1}) Unexecuted instantiation: void fmt::v11::detail::for_each_codepoint<fmt::v11::detail::find_escape(char const*, char const*)::{lambda(unsigned int, fmt::v11::basic_string_view<char>)#1}>(fmt::v11::basic_string_view<char>, fmt::v11::detail::find_escape(char const*, char const*)::{lambda(unsigned int, fmt::v11::basic_string_view<char>)#1}) Unexecuted instantiation: format.cc:void fmt::v11::detail::for_each_codepoint<fmt::v11::detail::utf8_to_utf16::utf8_to_utf16(fmt::v11::basic_string_view<char>)::$_0>(fmt::v11::basic_string_view<char>, fmt::v11::detail::utf8_to_utf16::utf8_to_utf16(fmt::v11::basic_string_view<char>)::$_0) |
643 | | |
644 | | template <typename Char> |
645 | | inline auto compute_width(basic_string_view<Char> s) -> size_t { |
646 | | return s.size(); |
647 | | } |
648 | | |
649 | | // Computes approximate display width of a UTF-8 string. |
650 | 43.6k | FMT_CONSTEXPR inline auto compute_width(string_view s) -> size_t { |
651 | 43.6k | size_t num_code_points = 0; |
652 | | // It is not a lambda for compatibility with C++14. |
653 | 43.6k | struct count_code_points { |
654 | 43.6k | size_t* count; |
655 | 5.16M | FMT_CONSTEXPR auto operator()(uint32_t cp, string_view) const -> bool { |
656 | 5.16M | *count += to_unsigned( |
657 | 5.16M | 1 + |
658 | 5.16M | (cp >= 0x1100 && |
659 | 5.16M | (cp <= 0x115f || // Hangul Jamo init. consonants |
660 | 1.10M | cp == 0x2329 || // LEFT-POINTING ANGLE BRACKET |
661 | 1.10M | cp == 0x232a || // RIGHT-POINTING ANGLE BRACKET |
662 | | // CJK ... Yi except IDEOGRAPHIC HALF FILL SPACE: |
663 | 1.10M | (cp >= 0x2e80 && cp <= 0xa4cf && cp != 0x303f) || |
664 | 1.10M | (cp >= 0xac00 && cp <= 0xd7a3) || // Hangul Syllables |
665 | 1.10M | (cp >= 0xf900 && cp <= 0xfaff) || // CJK Compatibility Ideographs |
666 | 1.10M | (cp >= 0xfe10 && cp <= 0xfe19) || // Vertical Forms |
667 | 1.10M | (cp >= 0xfe30 && cp <= 0xfe6f) || // CJK Compatibility Forms |
668 | 1.10M | (cp >= 0xff00 && cp <= 0xff60) || // Fullwidth Forms |
669 | 1.10M | (cp >= 0xffe0 && cp <= 0xffe6) || // Fullwidth Forms |
670 | 1.10M | (cp >= 0x20000 && cp <= 0x2fffd) || // CJK |
671 | 1.10M | (cp >= 0x30000 && cp <= 0x3fffd) || |
672 | | // Miscellaneous Symbols and Pictographs + Emoticons: |
673 | 1.10M | (cp >= 0x1f300 && cp <= 0x1f64f) || |
674 | | // Supplemental Symbols and Pictographs: |
675 | 1.10M | (cp >= 0x1f900 && cp <= 0x1f9ff)))); |
676 | 5.16M | return true; |
677 | 5.16M | } |
678 | 43.6k | }; |
679 | | // We could avoid branches by using utf8_decode directly. |
680 | 43.6k | for_each_codepoint(s, count_code_points{&num_code_points}); |
681 | 43.6k | return num_code_points; |
682 | 43.6k | } |
683 | | |
684 | | template <typename Char> |
685 | | inline auto code_point_index(basic_string_view<Char> s, size_t n) -> size_t { |
686 | | return min_of(n, s.size()); |
687 | | } |
688 | | |
689 | | // Calculates the index of the nth code point in a UTF-8 string. |
690 | 0 | inline auto code_point_index(string_view s, size_t n) -> size_t { |
691 | 0 | size_t result = s.size(); |
692 | 0 | const char* begin = s.begin(); |
693 | 0 | for_each_codepoint(s, [begin, &n, &result](uint32_t, string_view sv) { |
694 | 0 | if (n != 0) { |
695 | 0 | --n; |
696 | 0 | return true; |
697 | 0 | } |
698 | 0 | result = to_unsigned(sv.begin() - begin); |
699 | 0 | return false; |
700 | 0 | }); |
701 | 0 | return result; |
702 | 0 | } |
703 | | |
704 | | template <typename T> struct is_integral : std::is_integral<T> {}; |
705 | | template <> struct is_integral<int128_opt> : std::true_type {}; |
706 | | template <> struct is_integral<uint128_t> : std::true_type {}; |
707 | | |
708 | | template <typename T> |
709 | | using is_signed = |
710 | | std::integral_constant<bool, std::numeric_limits<T>::is_signed || |
711 | | std::is_same<T, int128_opt>::value>; |
712 | | |
713 | | template <typename T> |
714 | | using is_integer = |
715 | | bool_constant<is_integral<T>::value && !std::is_same<T, bool>::value && |
716 | | !std::is_same<T, char>::value && |
717 | | !std::is_same<T, wchar_t>::value>; |
718 | | |
719 | | #if defined(FMT_USE_FLOAT128) |
720 | | // Use the provided definition. |
721 | | #elif FMT_CLANG_VERSION && FMT_HAS_INCLUDE(<quadmath.h>) |
722 | | # define FMT_USE_FLOAT128 1 |
723 | | #elif FMT_GCC_VERSION && defined(_GLIBCXX_USE_FLOAT128) && \ |
724 | | !defined(__STRICT_ANSI__) |
725 | | # define FMT_USE_FLOAT128 1 |
726 | | #else |
727 | | # define FMT_USE_FLOAT128 0 |
728 | | #endif |
729 | | #if FMT_USE_FLOAT128 |
730 | | using float128 = __float128; |
731 | | #else |
732 | | struct float128 {}; |
733 | | #endif |
734 | | |
735 | | template <typename T> using is_float128 = std::is_same<T, float128>; |
736 | | |
737 | | template <typename T> |
738 | | using is_floating_point = |
739 | | bool_constant<std::is_floating_point<T>::value || is_float128<T>::value>; |
740 | | |
741 | | template <typename T, bool = std::is_floating_point<T>::value> |
742 | | struct is_fast_float : bool_constant<std::numeric_limits<T>::is_iec559 && |
743 | | sizeof(T) <= sizeof(double)> {}; |
744 | | template <typename T> struct is_fast_float<T, false> : std::false_type {}; |
745 | | |
746 | | template <typename T> |
747 | | using is_double_double = bool_constant<std::numeric_limits<T>::digits == 106>; |
748 | | |
749 | | #ifndef FMT_USE_FULL_CACHE_DRAGONBOX |
750 | | # define FMT_USE_FULL_CACHE_DRAGONBOX 0 |
751 | | #endif |
752 | | |
753 | | // An allocator that uses malloc/free to allow removing dependency on the C++ |
754 | | // standard libary runtime. |
755 | | template <typename T> struct allocator { |
756 | | using value_type = T; |
757 | | |
758 | 465k | T* allocate(size_t n) { |
759 | 465k | FMT_ASSERT(n <= max_value<size_t>() / sizeof(T), ""); |
760 | 465k | T* p = static_cast<T*>(malloc(n * sizeof(T))); |
761 | 465k | if (!p) FMT_THROW(std::bad_alloc()); |
762 | 465k | return p; |
763 | 465k | } fmt::v11::detail::allocator<char>::allocate(unsigned long) Line | Count | Source | 758 | 158k | T* allocate(size_t n) { | 759 | 158k | FMT_ASSERT(n <= max_value<size_t>() / sizeof(T), ""); | 760 | 158k | T* p = static_cast<T*>(malloc(n * sizeof(T))); | 761 | 158k | if (!p) FMT_THROW(std::bad_alloc()); | 762 | 158k | return p; | 763 | 158k | } |
Unexecuted instantiation: fmt::v11::detail::allocator<int>::allocate(unsigned long) fmt::v11::detail::allocator<unsigned int>::allocate(unsigned long) Line | Count | Source | 758 | 306k | T* allocate(size_t n) { | 759 | 306k | FMT_ASSERT(n <= max_value<size_t>() / sizeof(T), ""); | 760 | 306k | T* p = static_cast<T*>(malloc(n * sizeof(T))); | 761 | 306k | if (!p) FMT_THROW(std::bad_alloc()); | 762 | 306k | return p; | 763 | 306k | } |
Unexecuted instantiation: fmt::v11::detail::allocator<wchar_t>::allocate(unsigned long) |
764 | | |
765 | 465k | void deallocate(T* p, size_t) { free(p); } fmt::v11::detail::allocator<char>::deallocate(char*, unsigned long) Line | Count | Source | 765 | 158k | void deallocate(T* p, size_t) { free(p); } |
Unexecuted instantiation: fmt::v11::detail::allocator<int>::deallocate(int*, unsigned long) fmt::v11::detail::allocator<unsigned int>::deallocate(unsigned int*, unsigned long) Line | Count | Source | 765 | 306k | void deallocate(T* p, size_t) { free(p); } |
Unexecuted instantiation: fmt::v11::detail::allocator<wchar_t>::deallocate(wchar_t*, unsigned long) |
766 | | }; |
767 | | |
768 | | } // namespace detail |
769 | | |
770 | | FMT_BEGIN_EXPORT |
771 | | |
772 | | // The number of characters to store in the basic_memory_buffer object itself |
773 | | // to avoid dynamic memory allocation. |
774 | | enum { inline_buffer_size = 500 }; |
775 | | |
776 | | /** |
777 | | * A dynamically growing memory buffer for trivially copyable/constructible |
778 | | * types with the first `SIZE` elements stored in the object itself. Most |
779 | | * commonly used via the `memory_buffer` alias for `char`. |
780 | | * |
781 | | * **Example**: |
782 | | * |
783 | | * auto out = fmt::memory_buffer(); |
784 | | * fmt::format_to(std::back_inserter(out), "The answer is {}.", 42); |
785 | | * |
786 | | * This will append "The answer is 42." to `out`. The buffer content can be |
787 | | * converted to `std::string` with `to_string(out)`. |
788 | | */ |
789 | | template <typename T, size_t SIZE = inline_buffer_size, |
790 | | typename Allocator = detail::allocator<T>> |
791 | | class basic_memory_buffer : public detail::buffer<T> { |
792 | | private: |
793 | | T store_[SIZE]; |
794 | | |
795 | | // Don't inherit from Allocator to avoid generating type_info for it. |
796 | | FMT_NO_UNIQUE_ADDRESS Allocator alloc_; |
797 | | |
798 | | // Deallocate memory allocated by the buffer. |
799 | 2.10M | FMT_CONSTEXPR20 void deallocate() { |
800 | 2.10M | T* data = this->data(); |
801 | 2.10M | if (data != store_) alloc_.deallocate(data, this->capacity()); |
802 | 2.10M | } fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >::deallocate() Line | Count | Source | 799 | 830k | FMT_CONSTEXPR20 void deallocate() { | 800 | 830k | T* data = this->data(); | 801 | 830k | if (data != store_) alloc_.deallocate(data, this->capacity()); | 802 | 830k | } |
fmt::v11::basic_memory_buffer<unsigned int, 32ul, fmt::v11::detail::allocator<unsigned int> >::deallocate() Line | Count | Source | 799 | 1.25M | FMT_CONSTEXPR20 void deallocate() { | 800 | 1.25M | T* data = this->data(); | 801 | 1.25M | if (data != store_) alloc_.deallocate(data, this->capacity()); | 802 | 1.25M | } |
fmt::v11::basic_memory_buffer<int, 500ul, fmt::v11::detail::allocator<int> >::deallocate() Line | Count | Source | 799 | 14.2k | FMT_CONSTEXPR20 void deallocate() { | 800 | 14.2k | T* data = this->data(); | 801 | 14.2k | if (data != store_) alloc_.deallocate(data, this->capacity()); | 802 | 14.2k | } |
Unexecuted instantiation: fmt::v11::basic_memory_buffer<wchar_t, 500ul, fmt::v11::detail::allocator<wchar_t> >::deallocate() Unexecuted instantiation: fmt::v11::basic_memory_buffer<char, 128ul, fmt::v11::detail::allocator<char> >::deallocate() |
803 | | |
804 | 472k | static FMT_CONSTEXPR20 void grow(detail::buffer<T>& buf, size_t size) { |
805 | 472k | detail::abort_fuzzing_if(size > 5000); |
806 | 472k | auto& self = static_cast<basic_memory_buffer&>(buf); |
807 | 472k | const size_t max_size = |
808 | 472k | std::allocator_traits<Allocator>::max_size(self.alloc_); |
809 | 472k | size_t old_capacity = buf.capacity(); |
810 | 472k | size_t new_capacity = old_capacity + old_capacity / 2; |
811 | 472k | if (size > new_capacity) |
812 | 224k | new_capacity = size; |
813 | 247k | else if (new_capacity > max_size) |
814 | 0 | new_capacity = max_of(size, max_size); |
815 | 472k | T* old_data = buf.data(); |
816 | 472k | T* new_data = self.alloc_.allocate(new_capacity); |
817 | | // Suppress a bogus -Wstringop-overflow in gcc 13.1 (#3481). |
818 | 472k | detail::assume(buf.size() <= new_capacity); |
819 | | // The following code doesn't throw, so the raw pointer above doesn't leak. |
820 | 472k | memcpy(new_data, old_data, buf.size() * sizeof(T)); |
821 | 472k | self.set(new_data, new_capacity); |
822 | | // deallocate must not throw according to the standard, but even if it does, |
823 | | // the buffer already uses the new storage and will deallocate it in |
824 | | // destructor. |
825 | 472k | if (old_data != self.store_) self.alloc_.deallocate(old_data, old_capacity); |
826 | 472k | } fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >::grow(fmt::v11::detail::buffer<char>&, unsigned long) Line | Count | Source | 804 | 166k | static FMT_CONSTEXPR20 void grow(detail::buffer<T>& buf, size_t size) { | 805 | 166k | detail::abort_fuzzing_if(size > 5000); | 806 | 166k | auto& self = static_cast<basic_memory_buffer&>(buf); | 807 | 166k | const size_t max_size = | 808 | 166k | std::allocator_traits<Allocator>::max_size(self.alloc_); | 809 | 166k | size_t old_capacity = buf.capacity(); | 810 | 166k | size_t new_capacity = old_capacity + old_capacity / 2; | 811 | 166k | if (size > new_capacity) | 812 | 21.1k | new_capacity = size; | 813 | 145k | else if (new_capacity > max_size) | 814 | 0 | new_capacity = max_of(size, max_size); | 815 | 166k | T* old_data = buf.data(); | 816 | 166k | T* new_data = self.alloc_.allocate(new_capacity); | 817 | | // Suppress a bogus -Wstringop-overflow in gcc 13.1 (#3481). | 818 | 166k | detail::assume(buf.size() <= new_capacity); | 819 | | // The following code doesn't throw, so the raw pointer above doesn't leak. | 820 | 166k | memcpy(new_data, old_data, buf.size() * sizeof(T)); | 821 | 166k | self.set(new_data, new_capacity); | 822 | | // deallocate must not throw according to the standard, but even if it does, | 823 | | // the buffer already uses the new storage and will deallocate it in | 824 | | // destructor. | 825 | 166k | if (old_data != self.store_) self.alloc_.deallocate(old_data, old_capacity); | 826 | 166k | } |
Unexecuted instantiation: fmt::v11::basic_memory_buffer<int, 500ul, fmt::v11::detail::allocator<int> >::grow(fmt::v11::detail::buffer<int>&, unsigned long) fmt::v11::basic_memory_buffer<unsigned int, 32ul, fmt::v11::detail::allocator<unsigned int> >::grow(fmt::v11::detail::buffer<unsigned int>&, unsigned long) Line | Count | Source | 804 | 306k | static FMT_CONSTEXPR20 void grow(detail::buffer<T>& buf, size_t size) { | 805 | 306k | detail::abort_fuzzing_if(size > 5000); | 806 | 306k | auto& self = static_cast<basic_memory_buffer&>(buf); | 807 | 306k | const size_t max_size = | 808 | 306k | std::allocator_traits<Allocator>::max_size(self.alloc_); | 809 | 306k | size_t old_capacity = buf.capacity(); | 810 | 306k | size_t new_capacity = old_capacity + old_capacity / 2; | 811 | 306k | if (size > new_capacity) | 812 | 203k | new_capacity = size; | 813 | 102k | else if (new_capacity > max_size) | 814 | 0 | new_capacity = max_of(size, max_size); | 815 | 306k | T* old_data = buf.data(); | 816 | 306k | T* new_data = self.alloc_.allocate(new_capacity); | 817 | | // Suppress a bogus -Wstringop-overflow in gcc 13.1 (#3481). | 818 | 306k | detail::assume(buf.size() <= new_capacity); | 819 | | // The following code doesn't throw, so the raw pointer above doesn't leak. | 820 | 306k | memcpy(new_data, old_data, buf.size() * sizeof(T)); | 821 | 306k | self.set(new_data, new_capacity); | 822 | | // deallocate must not throw according to the standard, but even if it does, | 823 | | // the buffer already uses the new storage and will deallocate it in | 824 | | // destructor. | 825 | 306k | if (old_data != self.store_) self.alloc_.deallocate(old_data, old_capacity); | 826 | 306k | } |
Unexecuted instantiation: fmt::v11::basic_memory_buffer<wchar_t, 500ul, fmt::v11::detail::allocator<wchar_t> >::grow(fmt::v11::detail::buffer<wchar_t>&, unsigned long) Unexecuted instantiation: fmt::v11::basic_memory_buffer<char, 128ul, fmt::v11::detail::allocator<char> >::grow(fmt::v11::detail::buffer<char>&, unsigned long) |
827 | | |
828 | | public: |
829 | | using value_type = T; |
830 | | using const_reference = const T&; |
831 | | |
832 | | FMT_CONSTEXPR explicit basic_memory_buffer( |
833 | | const Allocator& alloc = Allocator()) |
834 | 1.30M | : detail::buffer<T>(grow), alloc_(alloc) { |
835 | 1.30M | this->set(store_, SIZE); |
836 | 1.30M | if (detail::is_constant_evaluated()) detail::fill_n(store_, SIZE, T()); |
837 | 1.30M | } fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >::basic_memory_buffer(fmt::v11::detail::allocator<char> const&) Line | Count | Source | 834 | 830k | : detail::buffer<T>(grow), alloc_(alloc) { | 835 | 830k | this->set(store_, SIZE); | 836 | 830k | if (detail::is_constant_evaluated()) detail::fill_n(store_, SIZE, T()); | 837 | 830k | } |
Unexecuted instantiation: fmt::v11::basic_memory_buffer<wchar_t, 500ul, fmt::v11::detail::allocator<wchar_t> >::basic_memory_buffer(fmt::v11::detail::allocator<wchar_t> const&) fmt::v11::basic_memory_buffer<int, 500ul, fmt::v11::detail::allocator<int> >::basic_memory_buffer(fmt::v11::detail::allocator<int> const&) Line | Count | Source | 834 | 14.2k | : detail::buffer<T>(grow), alloc_(alloc) { | 835 | 14.2k | this->set(store_, SIZE); | 836 | 14.2k | if (detail::is_constant_evaluated()) detail::fill_n(store_, SIZE, T()); | 837 | 14.2k | } |
fmt::v11::basic_memory_buffer<unsigned int, 32ul, fmt::v11::detail::allocator<unsigned int> >::basic_memory_buffer(fmt::v11::detail::allocator<unsigned int> const&) Line | Count | Source | 834 | 457k | : detail::buffer<T>(grow), alloc_(alloc) { | 835 | 457k | this->set(store_, SIZE); | 836 | 457k | if (detail::is_constant_evaluated()) detail::fill_n(store_, SIZE, T()); | 837 | 457k | } |
Unexecuted instantiation: fmt::v11::basic_memory_buffer<char, 128ul, fmt::v11::detail::allocator<char> >::basic_memory_buffer(fmt::v11::detail::allocator<char> const&) |
838 | 2.10M | FMT_CONSTEXPR20 ~basic_memory_buffer() { deallocate(); } fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >::~basic_memory_buffer() Line | Count | Source | 838 | 830k | FMT_CONSTEXPR20 ~basic_memory_buffer() { deallocate(); } |
fmt::v11::basic_memory_buffer<int, 500ul, fmt::v11::detail::allocator<int> >::~basic_memory_buffer() Line | Count | Source | 838 | 14.2k | FMT_CONSTEXPR20 ~basic_memory_buffer() { deallocate(); } |
fmt::v11::basic_memory_buffer<unsigned int, 32ul, fmt::v11::detail::allocator<unsigned int> >::~basic_memory_buffer() Line | Count | Source | 838 | 1.25M | FMT_CONSTEXPR20 ~basic_memory_buffer() { deallocate(); } |
Unexecuted instantiation: fmt::v11::basic_memory_buffer<wchar_t, 500ul, fmt::v11::detail::allocator<wchar_t> >::~basic_memory_buffer() Unexecuted instantiation: fmt::v11::basic_memory_buffer<char, 128ul, fmt::v11::detail::allocator<char> >::~basic_memory_buffer() |
839 | | |
840 | | private: |
841 | | // Move data from other to this buffer. |
842 | 798k | FMT_CONSTEXPR20 void move(basic_memory_buffer& other) { |
843 | 798k | alloc_ = std::move(other.alloc_); |
844 | 798k | T* data = other.data(); |
845 | 798k | size_t size = other.size(), capacity = other.capacity(); |
846 | 798k | if (data == other.store_) { |
847 | 653k | this->set(store_, capacity); |
848 | 653k | detail::copy<T>(other.store_, other.store_ + size, store_); |
849 | 653k | } else { |
850 | 144k | this->set(data, capacity); |
851 | | // Set pointer to the inline array so that delete is not called |
852 | | // when deallocating. |
853 | 144k | other.set(other.store_, 0); |
854 | 144k | other.clear(); |
855 | 144k | } |
856 | 798k | this->resize(size); |
857 | 798k | } fmt::v11::basic_memory_buffer<unsigned int, 32ul, fmt::v11::detail::allocator<unsigned int> >::move(fmt::v11::basic_memory_buffer<unsigned int, 32ul, fmt::v11::detail::allocator<unsigned int> >&) Line | Count | Source | 842 | 798k | FMT_CONSTEXPR20 void move(basic_memory_buffer& other) { | 843 | 798k | alloc_ = std::move(other.alloc_); | 844 | 798k | T* data = other.data(); | 845 | 798k | size_t size = other.size(), capacity = other.capacity(); | 846 | 798k | if (data == other.store_) { | 847 | 653k | this->set(store_, capacity); | 848 | 653k | detail::copy<T>(other.store_, other.store_ + size, store_); | 849 | 653k | } else { | 850 | 144k | this->set(data, capacity); | 851 | | // Set pointer to the inline array so that delete is not called | 852 | | // when deallocating. | 853 | 144k | other.set(other.store_, 0); | 854 | 144k | other.clear(); | 855 | 144k | } | 856 | 798k | this->resize(size); | 857 | 798k | } |
Unexecuted instantiation: fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >::move(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&) Unexecuted instantiation: fmt::v11::basic_memory_buffer<int, 500ul, fmt::v11::detail::allocator<int> >::move(fmt::v11::basic_memory_buffer<int, 500ul, fmt::v11::detail::allocator<int> >&) Unexecuted instantiation: fmt::v11::basic_memory_buffer<char, 128ul, fmt::v11::detail::allocator<char> >::move(fmt::v11::basic_memory_buffer<char, 128ul, fmt::v11::detail::allocator<char> >&) |
858 | | |
859 | | public: |
860 | | /// Constructs a `basic_memory_buffer` object moving the content of the other |
861 | | /// object to it. |
862 | | FMT_CONSTEXPR20 basic_memory_buffer(basic_memory_buffer&& other) noexcept |
863 | 798k | : detail::buffer<T>(grow) { |
864 | 798k | move(other); |
865 | 798k | } |
866 | | |
867 | | /// Moves the content of the other `basic_memory_buffer` object to this one. |
868 | | auto operator=(basic_memory_buffer&& other) noexcept -> basic_memory_buffer& { |
869 | | FMT_ASSERT(this != &other, ""); |
870 | | deallocate(); |
871 | | move(other); |
872 | | return *this; |
873 | | } |
874 | | |
875 | | // Returns a copy of the allocator associated with this buffer. |
876 | | auto get_allocator() const -> Allocator { return alloc_; } |
877 | | |
878 | | /// Resizes the buffer to contain `count` elements. If T is a POD type new |
879 | | /// elements may not be initialized. |
880 | 17.3M | FMT_CONSTEXPR void resize(size_t count) { this->try_resize(count); } fmt::v11::basic_memory_buffer<unsigned int, 32ul, fmt::v11::detail::allocator<unsigned int> >::resize(unsigned long) Line | Count | Source | 880 | 17.3M | FMT_CONSTEXPR void resize(size_t count) { this->try_resize(count); } |
Unexecuted instantiation: fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >::resize(unsigned long) Unexecuted instantiation: fmt::v11::basic_memory_buffer<int, 500ul, fmt::v11::detail::allocator<int> >::resize(unsigned long) Unexecuted instantiation: fmt::v11::basic_memory_buffer<char, 128ul, fmt::v11::detail::allocator<char> >::resize(unsigned long) |
881 | | |
882 | | /// Increases the buffer capacity to `new_capacity`. |
883 | | void reserve(size_t new_capacity) { this->try_reserve(new_capacity); } |
884 | | |
885 | | using detail::buffer<T>::append; |
886 | | template <typename ContiguousRange> |
887 | 0 | FMT_CONSTEXPR20 void append(const ContiguousRange& range) { |
888 | 0 | append(range.data(), range.data() + range.size()); |
889 | 0 | } |
890 | | }; |
891 | | |
892 | | using memory_buffer = basic_memory_buffer<char>; |
893 | | |
894 | | template <size_t SIZE> |
895 | | FMT_NODISCARD auto to_string(basic_memory_buffer<char, SIZE>& buf) |
896 | 202 | -> std::string { |
897 | 202 | auto size = buf.size(); |
898 | 202 | detail::assume(size < std::string().max_size()); |
899 | 202 | return {buf.data(), size}; |
900 | 202 | } |
901 | | |
902 | | // A writer to a buffered stream. It doesn't own the underlying stream. |
903 | | class writer { |
904 | | private: |
905 | | detail::buffer<char>* buf_; |
906 | | |
907 | | // We cannot create a file buffer in advance because any write to a FILE may |
908 | | // invalidate it. |
909 | | FILE* file_; |
910 | | |
911 | | public: |
912 | 0 | inline writer(FILE* f) : buf_(nullptr), file_(f) {} |
913 | 0 | inline writer(detail::buffer<char>& buf) : buf_(&buf) {} |
914 | | |
915 | | /// Formats `args` according to specifications in `fmt` and writes the |
916 | | /// output to the file. |
917 | | template <typename... T> void print(format_string<T...> fmt, T&&... args) { |
918 | | if (buf_) |
919 | | fmt::format_to(appender(*buf_), fmt, std::forward<T>(args)...); |
920 | | else |
921 | | fmt::print(file_, fmt, std::forward<T>(args)...); |
922 | | } |
923 | | }; |
924 | | |
925 | | class string_buffer { |
926 | | private: |
927 | | std::string str_; |
928 | | detail::container_buffer<std::string> buf_; |
929 | | |
930 | | public: |
931 | 0 | inline string_buffer() : buf_(str_) {} |
932 | | |
933 | 0 | inline operator writer() { return buf_; } |
934 | 0 | inline std::string& str() { return str_; } |
935 | | }; |
936 | | |
937 | | template <typename T, size_t SIZE, typename Allocator> |
938 | | struct is_contiguous<basic_memory_buffer<T, SIZE, Allocator>> : std::true_type { |
939 | | }; |
940 | | |
941 | | FMT_END_EXPORT |
942 | | namespace detail { |
943 | | FMT_API auto write_console(int fd, string_view text) -> bool; |
944 | | FMT_API void print(FILE*, string_view); |
945 | | } // namespace detail |
946 | | |
947 | | FMT_BEGIN_EXPORT |
948 | | |
949 | | // Suppress a misleading warning in older versions of clang. |
950 | | FMT_PRAGMA_CLANG(diagnostic ignored "-Wweak-vtables") |
951 | | |
952 | | /// An error reported from a formatting function. |
953 | | class FMT_SO_VISIBILITY("default") format_error : public std::runtime_error { |
954 | | public: |
955 | | using std::runtime_error::runtime_error; |
956 | | }; |
957 | | |
958 | | namespace detail { |
959 | | template <typename Char, size_t N> struct fixed_string { |
960 | | FMT_CONSTEXPR20 fixed_string(const Char (&s)[N]) { |
961 | | detail::copy<Char, const Char*, Char*>(static_cast<const Char*>(s), s + N, |
962 | | data); |
963 | | } |
964 | | Char data[N] = {}; |
965 | | }; |
966 | | |
967 | | // Converts a compile-time string to basic_string_view. |
968 | | template <typename Char, size_t N> |
969 | | constexpr auto compile_string_to_view(const Char (&s)[N]) |
970 | 301k | -> basic_string_view<Char> { |
971 | | // Remove trailing NUL character if needed. Won't be present if this is used |
972 | | // with a raw character array (i.e. not defined as a string). |
973 | 301k | return {s, N - (std::char_traits<Char>::to_int_type(s[N - 1]) == 0 ? 1 : 0)}; |
974 | 301k | } Unexecuted instantiation: fmt::v11::basic_string_view<char> fmt::v11::detail::compile_string_to_view<char, 5ul>(char const (&) [5ul]) Unexecuted instantiation: fmt::v11::basic_string_view<char> fmt::v11::detail::compile_string_to_view<char, 21ul>(char const (&) [21ul]) Unexecuted instantiation: fmt::v11::basic_string_view<char> fmt::v11::detail::compile_string_to_view<char, 7ul>(char const (&) [7ul]) Unexecuted instantiation: fmt::v11::basic_string_view<char> fmt::v11::detail::compile_string_to_view<char, 4ul>(char const (&) [4ul]) Unexecuted instantiation: fmt::v11::basic_string_view<char> fmt::v11::detail::compile_string_to_view<char, 12ul>(char const (&) [12ul]) Unexecuted instantiation: fmt::v11::basic_string_view<char> fmt::v11::detail::compile_string_to_view<char, 14ul>(char const (&) [14ul]) fmt::v11::basic_string_view<char> fmt::v11::detail::compile_string_to_view<char, 8ul>(char const (&) [8ul]) Line | Count | Source | 970 | 301k | -> basic_string_view<Char> { | 971 | | // Remove trailing NUL character if needed. Won't be present if this is used | 972 | | // with a raw character array (i.e. not defined as a string). | 973 | 301k | return {s, N - (std::char_traits<Char>::to_int_type(s[N - 1]) == 0 ? 1 : 0)}; | 974 | 301k | } |
|
975 | | template <typename Char> |
976 | | constexpr auto compile_string_to_view(basic_string_view<Char> s) |
977 | | -> basic_string_view<Char> { |
978 | | return s; |
979 | | } |
980 | | } // namespace detail |
981 | | |
982 | | // A generic formatting context with custom output iterator and character |
983 | | // (code unit) support. Char is the format string code unit type which can be |
984 | | // different from OutputIt::value_type. |
985 | | template <typename OutputIt, typename Char> class generic_context { |
986 | | private: |
987 | | OutputIt out_; |
988 | | basic_format_args<generic_context> args_; |
989 | | detail::locale_ref loc_; |
990 | | |
991 | | public: |
992 | | using char_type = Char; |
993 | | using iterator = OutputIt; |
994 | | using parse_context_type FMT_DEPRECATED = parse_context<Char>; |
995 | | template <typename T> |
996 | | using formatter_type FMT_DEPRECATED = formatter<T, Char>; |
997 | | enum { builtin_types = FMT_BUILTIN_TYPES }; |
998 | | |
999 | | constexpr generic_context(OutputIt out, |
1000 | | basic_format_args<generic_context> args, |
1001 | | detail::locale_ref loc = {}) |
1002 | | : out_(out), args_(args), loc_(loc) {} |
1003 | | generic_context(generic_context&&) = default; |
1004 | | generic_context(const generic_context&) = delete; |
1005 | | void operator=(const generic_context&) = delete; |
1006 | | |
1007 | | constexpr auto arg(int id) const -> basic_format_arg<generic_context> { |
1008 | | return args_.get(id); |
1009 | | } |
1010 | | auto arg(basic_string_view<Char> name) -> basic_format_arg<generic_context> { |
1011 | | return args_.get(name); |
1012 | | } |
1013 | | FMT_CONSTEXPR auto arg_id(basic_string_view<Char> name) -> int { |
1014 | | return args_.get_id(name); |
1015 | | } |
1016 | | |
1017 | | FMT_CONSTEXPR auto out() -> iterator { return out_; } |
1018 | | |
1019 | | void advance_to(iterator it) { |
1020 | | if (!detail::is_back_insert_iterator<iterator>()) out_ = it; |
1021 | | } |
1022 | | |
1023 | | FMT_CONSTEXPR auto locale() -> detail::locale_ref { return loc_; } |
1024 | | }; |
1025 | | |
1026 | | class loc_value { |
1027 | | private: |
1028 | | basic_format_arg<context> value_; |
1029 | | |
1030 | | public: |
1031 | | template <typename T, FMT_ENABLE_IF(!detail::is_float128<T>::value)> |
1032 | 17.3k | loc_value(T value) : value_(value) {} _ZN3fmt3v119loc_valueC2IiTnNSt3__19enable_ifIXntsr6detail11is_float128IT_EE5valueEiE4typeELi0EEES5_ Line | Count | Source | 1032 | 5.71k | loc_value(T value) : value_(value) {} |
_ZN3fmt3v119loc_valueC2IeTnNSt3__19enable_ifIXntsr6detail11is_float128IT_EE5valueEiE4typeELi0EEES5_ Line | Count | Source | 1032 | 696 | loc_value(T value) : value_(value) {} |
_ZN3fmt3v119loc_valueC2IjTnNSt3__19enable_ifIXntsr6detail11is_float128IT_EE5valueEiE4typeELi0EEES5_ Line | Count | Source | 1032 | 1.80k | loc_value(T value) : value_(value) {} |
_ZN3fmt3v119loc_valueC2IxTnNSt3__19enable_ifIXntsr6detail11is_float128IT_EE5valueEiE4typeELi0EEES5_ Line | Count | Source | 1032 | 4.42k | loc_value(T value) : value_(value) {} |
_ZN3fmt3v119loc_valueC2IyTnNSt3__19enable_ifIXntsr6detail11is_float128IT_EE5valueEiE4typeELi0EEES5_ Line | Count | Source | 1032 | 1.55k | loc_value(T value) : value_(value) {} |
Unexecuted instantiation: _ZN3fmt3v119loc_valueC2InTnNSt3__19enable_ifIXntsr6detail11is_float128IT_EE5valueEiE4typeELi0EEES5_ Unexecuted instantiation: _ZN3fmt3v119loc_valueC2IoTnNSt3__19enable_ifIXntsr6detail11is_float128IT_EE5valueEiE4typeELi0EEES5_ _ZN3fmt3v119loc_valueC2IhTnNSt3__19enable_ifIXntsr6detail11is_float128IT_EE5valueEiE4typeELi0EEES5_ Line | Count | Source | 1032 | 1.41k | loc_value(T value) : value_(value) {} |
_ZN3fmt3v119loc_valueC2IfTnNSt3__19enable_ifIXntsr6detail11is_float128IT_EE5valueEiE4typeELi0EEES5_ Line | Count | Source | 1032 | 659 | loc_value(T value) : value_(value) {} |
_ZN3fmt3v119loc_valueC2IdTnNSt3__19enable_ifIXntsr6detail11is_float128IT_EE5valueEiE4typeELi0EEES5_ Line | Count | Source | 1032 | 1.07k | loc_value(T value) : value_(value) {} |
|
1033 | | |
1034 | | template <typename T, FMT_ENABLE_IF(detail::is_float128<T>::value)> |
1035 | | loc_value(T) {} |
1036 | | |
1037 | 17.3k | template <typename Visitor> auto visit(Visitor&& vis) -> decltype(vis(0)) { |
1038 | 17.3k | return value_.visit(vis); |
1039 | 17.3k | } |
1040 | | }; |
1041 | | |
1042 | | // A locale facet that formats values in UTF-8. |
1043 | | // It is parameterized on the locale to avoid the heavy <locale> include. |
1044 | | template <typename Locale> class format_facet : public Locale::facet { |
1045 | | private: |
1046 | | std::string separator_; |
1047 | | std::string grouping_; |
1048 | | std::string decimal_point_; |
1049 | | |
1050 | | protected: |
1051 | | virtual auto do_put(appender out, loc_value val, |
1052 | | const format_specs& specs) const -> bool; |
1053 | | |
1054 | | public: |
1055 | | static FMT_API typename Locale::id id; |
1056 | | |
1057 | | explicit format_facet(Locale& loc); |
1058 | | explicit format_facet(string_view sep = "", |
1059 | | std::initializer_list<unsigned char> g = {3}, |
1060 | | std::string decimal_point = ".") |
1061 | | : separator_(sep.data(), sep.size()), |
1062 | | grouping_(g.begin(), g.end()), |
1063 | | decimal_point_(decimal_point) {} |
1064 | | |
1065 | | auto put(appender out, loc_value val, const format_specs& specs) const |
1066 | 17.3k | -> bool { |
1067 | 17.3k | return do_put(out, val, specs); |
1068 | 17.3k | } |
1069 | | }; |
1070 | | |
1071 | | FMT_END_EXPORT |
1072 | | |
1073 | | namespace detail { |
1074 | | |
1075 | | // Returns true if value is negative, false otherwise. |
1076 | | // Same as `value < 0` but doesn't produce warnings if T is an unsigned type. |
1077 | | template <typename T, FMT_ENABLE_IF(is_signed<T>::value)> |
1078 | 341k | constexpr auto is_negative(T value) -> bool { |
1079 | 341k | return value < 0; |
1080 | 341k | } _ZN3fmt3v116detail11is_negativeIiTnNSt3__19enable_ifIXsr9is_signedIT_EE5valueEiE4typeELi0EEEbS5_ Line | Count | Source | 1078 | 188k | constexpr auto is_negative(T value) -> bool { | 1079 | 188k | return value < 0; | 1080 | 188k | } |
_ZN3fmt3v116detail11is_negativeIxTnNSt3__19enable_ifIXsr9is_signedIT_EE5valueEiE4typeELi0EEEbS5_ Line | Count | Source | 1078 | 26.8k | constexpr auto is_negative(T value) -> bool { | 1079 | 26.8k | return value < 0; | 1080 | 26.8k | } |
Unexecuted instantiation: _ZN3fmt3v116detail11is_negativeInTnNSt3__19enable_ifIXsr9is_signedIT_EE5valueEiE4typeELi0EEEbS5_ _ZN3fmt3v116detail11is_negativeIlTnNSt3__19enable_ifIXsr9is_signedIT_EE5valueEiE4typeELi0EEEbS5_ Line | Count | Source | 1078 | 108k | constexpr auto is_negative(T value) -> bool { | 1079 | 108k | return value < 0; | 1080 | 108k | } |
_ZN3fmt3v116detail11is_negativeIaTnNSt3__19enable_ifIXsr9is_signedIT_EE5valueEiE4typeELi0EEEbS5_ Line | Count | Source | 1078 | 8.32k | constexpr auto is_negative(T value) -> bool { | 1079 | 8.32k | return value < 0; | 1080 | 8.32k | } |
_ZN3fmt3v116detail11is_negativeIsTnNSt3__19enable_ifIXsr9is_signedIT_EE5valueEiE4typeELi0EEEbS5_ Line | Count | Source | 1078 | 9.07k | constexpr auto is_negative(T value) -> bool { | 1079 | 9.07k | return value < 0; | 1080 | 9.07k | } |
|
1081 | | template <typename T, FMT_ENABLE_IF(!is_signed<T>::value)> |
1082 | 141k | constexpr auto is_negative(T) -> bool { |
1083 | 141k | return false; |
1084 | 141k | } _ZN3fmt3v116detail11is_negativeIjTnNSt3__19enable_ifIXntsr9is_signedIT_EE5valueEiE4typeELi0EEEbS5_ Line | Count | Source | 1082 | 88.1k | constexpr auto is_negative(T) -> bool { | 1083 | 88.1k | return false; | 1084 | 88.1k | } |
_ZN3fmt3v116detail11is_negativeIyTnNSt3__19enable_ifIXntsr9is_signedIT_EE5valueEiE4typeELi0EEEbS5_ Line | Count | Source | 1082 | 12.4k | constexpr auto is_negative(T) -> bool { | 1083 | 12.4k | return false; | 1084 | 12.4k | } |
Unexecuted instantiation: _ZN3fmt3v116detail11is_negativeIoTnNSt3__19enable_ifIXntsr9is_signedIT_EE5valueEiE4typeELi0EEEbS5_ _ZN3fmt3v116detail11is_negativeIhTnNSt3__19enable_ifIXntsr9is_signedIT_EE5valueEiE4typeELi0EEEbS5_ Line | Count | Source | 1082 | 10.1k | constexpr auto is_negative(T) -> bool { | 1083 | 10.1k | return false; | 1084 | 10.1k | } |
_ZN3fmt3v116detail11is_negativeItTnNSt3__19enable_ifIXntsr9is_signedIT_EE5valueEiE4typeELi0EEEbS5_ Line | Count | Source | 1082 | 7.66k | constexpr auto is_negative(T) -> bool { | 1083 | 7.66k | return false; | 1084 | 7.66k | } |
_ZN3fmt3v116detail11is_negativeImTnNSt3__19enable_ifIXntsr9is_signedIT_EE5valueEiE4typeELi0EEEbS5_ Line | Count | Source | 1082 | 23.4k | constexpr auto is_negative(T) -> bool { | 1083 | 23.4k | return false; | 1084 | 23.4k | } |
|
1085 | | |
1086 | | // Smallest of uint32_t, uint64_t, uint128_t that is large enough to |
1087 | | // represent all values of an integral type T. |
1088 | | template <typename T> |
1089 | | using uint32_or_64_or_128_t = |
1090 | | conditional_t<num_bits<T>() <= 32 && !FMT_REDUCE_INT_INSTANTIATIONS, |
1091 | | uint32_t, |
1092 | | conditional_t<num_bits<T>() <= 64, uint64_t, uint128_t>>; |
1093 | | template <typename T> |
1094 | | using uint64_or_128_t = conditional_t<num_bits<T>() <= 64, uint64_t, uint128_t>; |
1095 | | |
1096 | | #define FMT_POWERS_OF_10(factor) \ |
1097 | 1.96M | factor * 10, (factor) * 100, (factor) * 1000, (factor) * 10000, \ |
1098 | 1.96M | (factor) * 100000, (factor) * 1000000, (factor) * 10000000, \ |
1099 | 1.96M | (factor) * 100000000, (factor) * 1000000000 |
1100 | | |
1101 | | // Converts value in the range [0, 100) to a string. |
1102 | | // GCC generates slightly better code when value is pointer-size. |
1103 | 2.69M | inline auto digits2(size_t value) -> const char* { |
1104 | | // Align data since unaligned access may be slower when crossing a |
1105 | | // hardware-specific boundary. |
1106 | 2.69M | alignas(2) static const char data[] = |
1107 | 2.69M | "0001020304050607080910111213141516171819" |
1108 | 2.69M | "2021222324252627282930313233343536373839" |
1109 | 2.69M | "4041424344454647484950515253545556575859" |
1110 | 2.69M | "6061626364656667686970717273747576777879" |
1111 | 2.69M | "8081828384858687888990919293949596979899"; |
1112 | 2.69M | return &data[value * 2]; |
1113 | 2.69M | } |
1114 | | |
1115 | 93.4k | template <typename Char> constexpr auto getsign(sign s) -> Char { |
1116 | 93.4k | return static_cast<char>(((' ' << 24) | ('+' << 16) | ('-' << 8)) >> |
1117 | 93.4k | (static_cast<int>(s) * 8)); |
1118 | 93.4k | } |
1119 | | |
1120 | 0 | template <typename T> FMT_CONSTEXPR auto count_digits_fallback(T n) -> int { |
1121 | 0 | int count = 1; |
1122 | 0 | for (;;) { |
1123 | | // Integer division is slow so do it for a group of four digits instead |
1124 | | // of for every digit. The idea comes from the talk by Alexandrescu |
1125 | | // "Three Optimization Tips for C++". See speed-test for a comparison. |
1126 | 0 | if (n < 10) return count; |
1127 | 0 | if (n < 100) return count + 1; |
1128 | 0 | if (n < 1000) return count + 2; |
1129 | 0 | if (n < 10000) return count + 3; |
1130 | 0 | n /= 10000u; |
1131 | 0 | count += 4; |
1132 | 0 | } |
1133 | 0 | } Unexecuted instantiation: int fmt::v11::detail::count_digits_fallback<unsigned __int128>(unsigned __int128) Unexecuted instantiation: int fmt::v11::detail::count_digits_fallback<unsigned long>(unsigned long) Unexecuted instantiation: int fmt::v11::detail::count_digits_fallback<unsigned int>(unsigned int) |
1134 | | #if FMT_USE_INT128 |
1135 | 0 | FMT_CONSTEXPR inline auto count_digits(uint128_opt n) -> int { |
1136 | 0 | return count_digits_fallback(n); |
1137 | 0 | } |
1138 | | #endif |
1139 | | |
1140 | | #ifdef FMT_BUILTIN_CLZLL |
1141 | | // It is a separate function rather than a part of count_digits to workaround |
1142 | | // the lack of static constexpr in constexpr functions. |
1143 | 982k | inline auto do_count_digits(uint64_t n) -> int { |
1144 | | // This has comparable performance to the version by Kendall Willets |
1145 | | // (https://github.com/fmtlib/format-benchmark/blob/master/digits10) |
1146 | | // but uses smaller tables. |
1147 | | // Maps bsr(n) to ceil(log10(pow(2, bsr(n) + 1) - 1)). |
1148 | 982k | static constexpr uint8_t bsr2log10[] = { |
1149 | 982k | 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, |
1150 | 982k | 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, |
1151 | 982k | 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 15, 15, |
1152 | 982k | 15, 16, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 19, 20}; |
1153 | 982k | auto t = bsr2log10[FMT_BUILTIN_CLZLL(n | 1) ^ 63]; |
1154 | 982k | static constexpr const uint64_t zero_or_powers_of_10[] = { |
1155 | 982k | 0, 0, FMT_POWERS_OF_10(1U), FMT_POWERS_OF_10(1000000000ULL), |
1156 | 982k | 10000000000000000000ULL}; |
1157 | 982k | return t - (n < zero_or_powers_of_10[t]); |
1158 | 982k | } |
1159 | | #endif |
1160 | | |
1161 | | // Returns the number of decimal digits in n. Leading zeros are not counted |
1162 | | // except for n == 0 in which case count_digits returns 1. |
1163 | 982k | FMT_CONSTEXPR20 inline auto count_digits(uint64_t n) -> int { |
1164 | 982k | #ifdef FMT_BUILTIN_CLZLL |
1165 | 982k | if (!is_constant_evaluated() && !FMT_OPTIMIZE_SIZE) return do_count_digits(n); |
1166 | 0 | #endif |
1167 | 0 | return count_digits_fallback(n); |
1168 | 982k | } |
1169 | | |
1170 | | // Counts the number of digits in n. BITS = log2(radix). |
1171 | | template <int BITS, typename UInt> |
1172 | 107k | FMT_CONSTEXPR auto count_digits(UInt n) -> int { |
1173 | 107k | #ifdef FMT_BUILTIN_CLZ |
1174 | 107k | if (!is_constant_evaluated() && num_bits<UInt>() == 32) |
1175 | 0 | return (FMT_BUILTIN_CLZ(static_cast<uint32_t>(n) | 1) ^ 31) / BITS + 1; |
1176 | 107k | #endif |
1177 | | // Lambda avoids unreachable code warnings from NVHPC. |
1178 | 107k | return [](UInt m) { |
1179 | 107k | int num_digits = 0; |
1180 | 5.71M | do { |
1181 | 5.71M | ++num_digits; |
1182 | 5.71M | } while ((m >>= BITS) != 0); |
1183 | 107k | return num_digits; |
1184 | 107k | }(n); fmt::v11::detail::count_digits<1, unsigned __int128>(unsigned __int128)::{lambda(unsigned __int128)#1}::operator()(unsigned __int128) const Line | Count | Source | 1178 | 96.8k | return [](UInt m) { | 1179 | 96.8k | int num_digits = 0; | 1180 | 5.60M | do { | 1181 | 5.60M | ++num_digits; | 1182 | 5.60M | } while ((m >>= BITS) != 0); | 1183 | 96.8k | return num_digits; | 1184 | 96.8k | }(n); |
fmt::v11::detail::count_digits<4, unsigned long>(unsigned long)::{lambda(unsigned long)#1}::operator()(unsigned long) const Line | Count | Source | 1178 | 5.32k | return [](UInt m) { | 1179 | 5.32k | int num_digits = 0; | 1180 | 41.9k | do { | 1181 | 41.9k | ++num_digits; | 1182 | 41.9k | } while ((m >>= BITS) != 0); | 1183 | 5.32k | return num_digits; | 1184 | 5.32k | }(n); |
fmt::v11::detail::count_digits<3, unsigned long>(unsigned long)::{lambda(unsigned long)#1}::operator()(unsigned long) const Line | Count | Source | 1178 | 3.08k | return [](UInt m) { | 1179 | 3.08k | int num_digits = 0; | 1180 | 27.8k | do { | 1181 | 27.8k | ++num_digits; | 1182 | 27.8k | } while ((m >>= BITS) != 0); | 1183 | 3.08k | return num_digits; | 1184 | 3.08k | }(n); |
fmt::v11::detail::count_digits<1, unsigned long>(unsigned long)::{lambda(unsigned long)#1}::operator()(unsigned long) const Line | Count | Source | 1178 | 2.54k | return [](UInt m) { | 1179 | 2.54k | int num_digits = 0; | 1180 | 44.2k | do { | 1181 | 44.2k | ++num_digits; | 1182 | 44.2k | } while ((m >>= BITS) != 0); | 1183 | 2.54k | return num_digits; | 1184 | 2.54k | }(n); |
Unexecuted instantiation: fmt::v11::detail::count_digits<4, unsigned __int128>(unsigned __int128)::{lambda(unsigned __int128)#1}::operator()(unsigned __int128) const Unexecuted instantiation: fmt::v11::detail::count_digits<3, unsigned __int128>(unsigned __int128)::{lambda(unsigned __int128)#1}::operator()(unsigned __int128) const |
1185 | 107k | } int fmt::v11::detail::count_digits<1, unsigned __int128>(unsigned __int128) Line | Count | Source | 1172 | 96.8k | FMT_CONSTEXPR auto count_digits(UInt n) -> int { | 1173 | 96.8k | #ifdef FMT_BUILTIN_CLZ | 1174 | 96.8k | if (!is_constant_evaluated() && num_bits<UInt>() == 32) | 1175 | 0 | return (FMT_BUILTIN_CLZ(static_cast<uint32_t>(n) | 1) ^ 31) / BITS + 1; | 1176 | 96.8k | #endif | 1177 | | // Lambda avoids unreachable code warnings from NVHPC. | 1178 | 96.8k | return [](UInt m) { | 1179 | 96.8k | int num_digits = 0; | 1180 | 96.8k | do { | 1181 | 96.8k | ++num_digits; | 1182 | 96.8k | } while ((m >>= BITS) != 0); | 1183 | 96.8k | return num_digits; | 1184 | 96.8k | }(n); | 1185 | 96.8k | } |
int fmt::v11::detail::count_digits<4, unsigned long>(unsigned long) Line | Count | Source | 1172 | 5.32k | FMT_CONSTEXPR auto count_digits(UInt n) -> int { | 1173 | 5.32k | #ifdef FMT_BUILTIN_CLZ | 1174 | 5.32k | if (!is_constant_evaluated() && num_bits<UInt>() == 32) | 1175 | 0 | return (FMT_BUILTIN_CLZ(static_cast<uint32_t>(n) | 1) ^ 31) / BITS + 1; | 1176 | 5.32k | #endif | 1177 | | // Lambda avoids unreachable code warnings from NVHPC. | 1178 | 5.32k | return [](UInt m) { | 1179 | 5.32k | int num_digits = 0; | 1180 | 5.32k | do { | 1181 | 5.32k | ++num_digits; | 1182 | 5.32k | } while ((m >>= BITS) != 0); | 1183 | 5.32k | return num_digits; | 1184 | 5.32k | }(n); | 1185 | 5.32k | } |
int fmt::v11::detail::count_digits<3, unsigned long>(unsigned long) Line | Count | Source | 1172 | 3.08k | FMT_CONSTEXPR auto count_digits(UInt n) -> int { | 1173 | 3.08k | #ifdef FMT_BUILTIN_CLZ | 1174 | 3.08k | if (!is_constant_evaluated() && num_bits<UInt>() == 32) | 1175 | 0 | return (FMT_BUILTIN_CLZ(static_cast<uint32_t>(n) | 1) ^ 31) / BITS + 1; | 1176 | 3.08k | #endif | 1177 | | // Lambda avoids unreachable code warnings from NVHPC. | 1178 | 3.08k | return [](UInt m) { | 1179 | 3.08k | int num_digits = 0; | 1180 | 3.08k | do { | 1181 | 3.08k | ++num_digits; | 1182 | 3.08k | } while ((m >>= BITS) != 0); | 1183 | 3.08k | return num_digits; | 1184 | 3.08k | }(n); | 1185 | 3.08k | } |
int fmt::v11::detail::count_digits<1, unsigned long>(unsigned long) Line | Count | Source | 1172 | 2.54k | FMT_CONSTEXPR auto count_digits(UInt n) -> int { | 1173 | 2.54k | #ifdef FMT_BUILTIN_CLZ | 1174 | 2.54k | if (!is_constant_evaluated() && num_bits<UInt>() == 32) | 1175 | 0 | return (FMT_BUILTIN_CLZ(static_cast<uint32_t>(n) | 1) ^ 31) / BITS + 1; | 1176 | 2.54k | #endif | 1177 | | // Lambda avoids unreachable code warnings from NVHPC. | 1178 | 2.54k | return [](UInt m) { | 1179 | 2.54k | int num_digits = 0; | 1180 | 2.54k | do { | 1181 | 2.54k | ++num_digits; | 1182 | 2.54k | } while ((m >>= BITS) != 0); | 1183 | 2.54k | return num_digits; | 1184 | 2.54k | }(n); | 1185 | 2.54k | } |
Unexecuted instantiation: int fmt::v11::detail::count_digits<4, unsigned __int128>(unsigned __int128) Unexecuted instantiation: int fmt::v11::detail::count_digits<3, unsigned __int128>(unsigned __int128) |
1186 | | |
1187 | | #ifdef FMT_BUILTIN_CLZ |
1188 | | // It is a separate function rather than a part of count_digits to workaround |
1189 | | // the lack of static constexpr in constexpr functions. |
1190 | 3.98M | FMT_INLINE auto do_count_digits(uint32_t n) -> int { |
1191 | | // An optimization by Kendall Willets from https://bit.ly/3uOIQrB. |
1192 | | // This increments the upper 32 bits (log10(T) - 1) when >= T is added. |
1193 | 127M | # define FMT_INC(T) (((sizeof(#T) - 1ull) << 32) - T) |
1194 | 3.98M | static constexpr uint64_t table[] = { |
1195 | 3.98M | FMT_INC(0), FMT_INC(0), FMT_INC(0), // 8 |
1196 | 3.98M | FMT_INC(10), FMT_INC(10), FMT_INC(10), // 64 |
1197 | 3.98M | FMT_INC(100), FMT_INC(100), FMT_INC(100), // 512 |
1198 | 3.98M | FMT_INC(1000), FMT_INC(1000), FMT_INC(1000), // 4096 |
1199 | 3.98M | FMT_INC(10000), FMT_INC(10000), FMT_INC(10000), // 32k |
1200 | 3.98M | FMT_INC(100000), FMT_INC(100000), FMT_INC(100000), // 256k |
1201 | 3.98M | FMT_INC(1000000), FMT_INC(1000000), FMT_INC(1000000), // 2048k |
1202 | 3.98M | FMT_INC(10000000), FMT_INC(10000000), FMT_INC(10000000), // 16M |
1203 | 3.98M | FMT_INC(100000000), FMT_INC(100000000), FMT_INC(100000000), // 128M |
1204 | 3.98M | FMT_INC(1000000000), FMT_INC(1000000000), FMT_INC(1000000000), // 1024M |
1205 | 3.98M | FMT_INC(1000000000), FMT_INC(1000000000) // 4B |
1206 | 3.98M | }; |
1207 | 3.98M | auto inc = table[FMT_BUILTIN_CLZ(n | 1) ^ 31]; |
1208 | 3.98M | return static_cast<int>((n + inc) >> 32); |
1209 | 3.98M | } |
1210 | | #endif |
1211 | | |
1212 | | // Optional version of count_digits for better performance on 32-bit platforms. |
1213 | 3.98M | FMT_CONSTEXPR20 inline auto count_digits(uint32_t n) -> int { |
1214 | 3.98M | #ifdef FMT_BUILTIN_CLZ |
1215 | 3.98M | if (!is_constant_evaluated() && !FMT_OPTIMIZE_SIZE) return do_count_digits(n); |
1216 | 0 | #endif |
1217 | 0 | return count_digits_fallback(n); |
1218 | 3.98M | } |
1219 | | |
1220 | 0 | template <typename Int> constexpr auto digits10() noexcept -> int { |
1221 | 0 | return std::numeric_limits<Int>::digits10; |
1222 | 0 | } Unexecuted instantiation: int fmt::v11::detail::digits10<unsigned int>() Unexecuted instantiation: int fmt::v11::detail::digits10<unsigned long>() |
1223 | 0 | template <> constexpr auto digits10<int128_opt>() noexcept -> int { return 38; } |
1224 | 0 | template <> constexpr auto digits10<uint128_t>() noexcept -> int { return 38; } |
1225 | | |
1226 | | template <typename Char> struct thousands_sep_result { |
1227 | | std::string grouping; |
1228 | | Char thousands_sep; |
1229 | | }; |
1230 | | |
1231 | | template <typename Char> |
1232 | | FMT_API auto thousands_sep_impl(locale_ref loc) -> thousands_sep_result<Char>; |
1233 | | template <typename Char> |
1234 | 1.09k | inline auto thousands_sep(locale_ref loc) -> thousands_sep_result<Char> { |
1235 | 1.09k | auto result = thousands_sep_impl<char>(loc); |
1236 | 1.09k | return {result.grouping, Char(result.thousands_sep)}; |
1237 | 1.09k | } |
1238 | | template <> |
1239 | 0 | inline auto thousands_sep(locale_ref loc) -> thousands_sep_result<wchar_t> { |
1240 | 0 | return thousands_sep_impl<wchar_t>(loc); |
1241 | 0 | } |
1242 | | |
1243 | | template <typename Char> |
1244 | | FMT_API auto decimal_point_impl(locale_ref loc) -> Char; |
1245 | 2.21k | template <typename Char> inline auto decimal_point(locale_ref loc) -> Char { |
1246 | 2.21k | return Char(decimal_point_impl<char>(loc)); |
1247 | 2.21k | } |
1248 | 0 | template <> inline auto decimal_point(locale_ref loc) -> wchar_t { |
1249 | 0 | return decimal_point_impl<wchar_t>(loc); |
1250 | 0 | } |
1251 | | |
1252 | | #ifndef FMT_HEADER_ONLY |
1253 | | FMT_BEGIN_EXPORT |
1254 | | extern template FMT_API auto thousands_sep_impl<char>(locale_ref) |
1255 | | -> thousands_sep_result<char>; |
1256 | | extern template FMT_API auto thousands_sep_impl<wchar_t>(locale_ref) |
1257 | | -> thousands_sep_result<wchar_t>; |
1258 | | extern template FMT_API auto decimal_point_impl(locale_ref) -> char; |
1259 | | extern template FMT_API auto decimal_point_impl(locale_ref) -> wchar_t; |
1260 | | FMT_END_EXPORT |
1261 | | #endif // FMT_HEADER_ONLY |
1262 | | |
1263 | | // Compares two characters for equality. |
1264 | | template <typename Char> auto equal2(const Char* lhs, const char* rhs) -> bool { |
1265 | | return lhs[0] == Char(rhs[0]) && lhs[1] == Char(rhs[1]); |
1266 | | } |
1267 | 5.26k | inline auto equal2(const char* lhs, const char* rhs) -> bool { |
1268 | 5.26k | return memcmp(lhs, rhs, 2) == 0; |
1269 | 5.26k | } |
1270 | | |
1271 | | // Writes a two-digit value to out. |
1272 | | template <typename Char> |
1273 | 2.09M | FMT_CONSTEXPR20 FMT_INLINE void write2digits(Char* out, size_t value) { |
1274 | 2.09M | if (!is_constant_evaluated() && std::is_same<Char, char>::value && |
1275 | 2.09M | !FMT_OPTIMIZE_SIZE) { |
1276 | 2.09M | memcpy(out, digits2(value), 2); |
1277 | 2.09M | return; |
1278 | 2.09M | } |
1279 | 0 | *out++ = static_cast<Char>('0' + value / 10); |
1280 | 0 | *out = static_cast<Char>('0' + value % 10); |
1281 | 0 | } |
1282 | | |
1283 | | // Formats a decimal unsigned integer value writing to out pointing to a buffer |
1284 | | // of specified size. The caller must ensure that the buffer is large enough. |
1285 | | template <typename Char, typename UInt> |
1286 | | FMT_CONSTEXPR20 auto do_format_decimal(Char* out, UInt value, int size) |
1287 | 2.39M | -> Char* { |
1288 | 2.39M | FMT_ASSERT(size >= count_digits(value), "invalid digit count"); |
1289 | 2.39M | unsigned n = to_unsigned(size); |
1290 | 3.41M | while (value >= 100) { |
1291 | | // Integer division is slow so do it for a group of two digits instead |
1292 | | // of for every digit. The idea comes from the talk by Alexandrescu |
1293 | | // "Three Optimization Tips for C++". See speed-test for a comparison. |
1294 | 1.02M | n -= 2; |
1295 | 1.02M | write2digits(out + n, static_cast<unsigned>(value % 100)); |
1296 | 1.02M | value /= 100; |
1297 | 1.02M | } |
1298 | 2.39M | if (value >= 10) { |
1299 | 706k | n -= 2; |
1300 | 706k | write2digits(out + n, static_cast<unsigned>(value)); |
1301 | 1.68M | } else { |
1302 | 1.68M | out[--n] = static_cast<Char>('0' + value); |
1303 | 1.68M | } |
1304 | 2.39M | return out + n; |
1305 | 2.39M | } char* fmt::v11::detail::do_format_decimal<char, unsigned int>(char*, unsigned int, int) Line | Count | Source | 1287 | 1.99M | -> Char* { | 1288 | 1.99M | FMT_ASSERT(size >= count_digits(value), "invalid digit count"); | 1289 | 1.99M | unsigned n = to_unsigned(size); | 1290 | 2.19M | while (value >= 100) { | 1291 | | // Integer division is slow so do it for a group of two digits instead | 1292 | | // of for every digit. The idea comes from the talk by Alexandrescu | 1293 | | // "Three Optimization Tips for C++". See speed-test for a comparison. | 1294 | 198k | n -= 2; | 1295 | 198k | write2digits(out + n, static_cast<unsigned>(value % 100)); | 1296 | 198k | value /= 100; | 1297 | 198k | } | 1298 | 1.99M | if (value >= 10) { | 1299 | 480k | n -= 2; | 1300 | 480k | write2digits(out + n, static_cast<unsigned>(value)); | 1301 | 1.51M | } else { | 1302 | 1.51M | out[--n] = static_cast<Char>('0' + value); | 1303 | 1.51M | } | 1304 | 1.99M | return out + n; | 1305 | 1.99M | } |
char* fmt::v11::detail::do_format_decimal<char, unsigned long>(char*, unsigned long, int) Line | Count | Source | 1287 | 397k | -> Char* { | 1288 | 397k | FMT_ASSERT(size >= count_digits(value), "invalid digit count"); | 1289 | 397k | unsigned n = to_unsigned(size); | 1290 | 1.22M | while (value >= 100) { | 1291 | | // Integer division is slow so do it for a group of two digits instead | 1292 | | // of for every digit. The idea comes from the talk by Alexandrescu | 1293 | | // "Three Optimization Tips for C++". See speed-test for a comparison. | 1294 | 822k | n -= 2; | 1295 | 822k | write2digits(out + n, static_cast<unsigned>(value % 100)); | 1296 | 822k | value /= 100; | 1297 | 822k | } | 1298 | 397k | if (value >= 10) { | 1299 | 225k | n -= 2; | 1300 | 225k | write2digits(out + n, static_cast<unsigned>(value)); | 1301 | 225k | } else { | 1302 | 171k | out[--n] = static_cast<Char>('0' + value); | 1303 | 171k | } | 1304 | 397k | return out + n; | 1305 | 397k | } |
Unexecuted instantiation: char* fmt::v11::detail::do_format_decimal<char, unsigned __int128>(char*, unsigned __int128, int) |
1306 | | |
1307 | | template <typename Char, typename UInt> |
1308 | | FMT_CONSTEXPR FMT_INLINE auto format_decimal(Char* out, UInt value, |
1309 | 204k | int num_digits) -> Char* { |
1310 | 204k | do_format_decimal(out, value, num_digits); |
1311 | 204k | return out + num_digits; |
1312 | 204k | } char* fmt::v11::detail::format_decimal<char, unsigned int>(char*, unsigned int, int) Line | Count | Source | 1309 | 139k | int num_digits) -> Char* { | 1310 | 139k | do_format_decimal(out, value, num_digits); | 1311 | 139k | return out + num_digits; | 1312 | 139k | } |
char* fmt::v11::detail::format_decimal<char, unsigned long>(char*, unsigned long, int) Line | Count | Source | 1309 | 64.8k | int num_digits) -> Char* { | 1310 | 64.8k | do_format_decimal(out, value, num_digits); | 1311 | 64.8k | return out + num_digits; | 1312 | 64.8k | } |
Unexecuted instantiation: char* fmt::v11::detail::format_decimal<char, unsigned __int128>(char*, unsigned __int128, int) |
1313 | | |
1314 | | template <typename Char, typename UInt, typename OutputIt, |
1315 | | FMT_ENABLE_IF(is_back_insert_iterator<OutputIt>::value)> |
1316 | | FMT_CONSTEXPR auto format_decimal(OutputIt out, UInt value, int num_digits) |
1317 | 2.16M | -> OutputIt { |
1318 | 2.16M | if (auto ptr = to_pointer<Char>(out, to_unsigned(num_digits))) { |
1319 | 2.16M | do_format_decimal(ptr, value, num_digits); |
1320 | 2.16M | return out; |
1321 | 2.16M | } |
1322 | | // Buffer is large enough to hold all digits (digits10 + 1). |
1323 | 887 | char buffer[digits10<UInt>() + 1]; |
1324 | 887 | if (is_constant_evaluated()) fill_n(buffer, sizeof(buffer), '\0'); |
1325 | 887 | do_format_decimal(buffer, value, num_digits); |
1326 | 887 | return copy_noinline<Char>(buffer, buffer + num_digits, out); |
1327 | 2.16M | } _ZN3fmt3v116detail14format_decimalIcjNS0_14basic_appenderIcEETnNSt3__19enable_ifIXsr23is_back_insert_iteratorIT1_EE5valueEiE4typeELi0EEES7_S7_T0_i Line | Count | Source | 1317 | 1.84M | -> OutputIt { | 1318 | 1.84M | if (auto ptr = to_pointer<Char>(out, to_unsigned(num_digits))) { | 1319 | 1.84M | do_format_decimal(ptr, value, num_digits); | 1320 | 1.84M | return out; | 1321 | 1.84M | } | 1322 | | // Buffer is large enough to hold all digits (digits10 + 1). | 1323 | 380 | char buffer[digits10<UInt>() + 1]; | 1324 | 380 | if (is_constant_evaluated()) fill_n(buffer, sizeof(buffer), '\0'); | 1325 | 380 | do_format_decimal(buffer, value, num_digits); | 1326 | 380 | return copy_noinline<Char>(buffer, buffer + num_digits, out); | 1327 | 1.84M | } |
_ZN3fmt3v116detail14format_decimalIcmNS0_14basic_appenderIcEETnNSt3__19enable_ifIXsr23is_back_insert_iteratorIT1_EE5valueEiE4typeELi0EEES7_S7_T0_i Line | Count | Source | 1317 | 322k | -> OutputIt { | 1318 | 322k | if (auto ptr = to_pointer<Char>(out, to_unsigned(num_digits))) { | 1319 | 322k | do_format_decimal(ptr, value, num_digits); | 1320 | 322k | return out; | 1321 | 322k | } | 1322 | | // Buffer is large enough to hold all digits (digits10 + 1). | 1323 | 507 | char buffer[digits10<UInt>() + 1]; | 1324 | 507 | if (is_constant_evaluated()) fill_n(buffer, sizeof(buffer), '\0'); | 1325 | 507 | do_format_decimal(buffer, value, num_digits); | 1326 | 507 | return copy_noinline<Char>(buffer, buffer + num_digits, out); | 1327 | 322k | } |
Unexecuted instantiation: _ZN3fmt3v116detail14format_decimalIcoNS0_14basic_appenderIcEETnNSt3__19enable_ifIXsr23is_back_insert_iteratorIT1_EE5valueEiE4typeELi0EEES7_S7_T0_i |
1328 | | |
1329 | | template <typename Char, typename UInt> |
1330 | | FMT_CONSTEXPR auto do_format_base2e(int base_bits, Char* out, UInt value, |
1331 | 50.7k | int size, bool upper = false) -> Char* { |
1332 | 50.7k | out += size; |
1333 | 602k | do { |
1334 | 602k | const char* digits = upper ? "0123456789ABCDEF" : "0123456789abcdef"; |
1335 | 602k | unsigned digit = static_cast<unsigned>(value & ((1 << base_bits) - 1)); |
1336 | 602k | *--out = static_cast<Char>(base_bits < 4 ? static_cast<char>('0' + digit) |
1337 | 602k | : digits[digit]); |
1338 | 602k | } while ((value >>= base_bits) != 0); |
1339 | 50.7k | return out; |
1340 | 50.7k | } char* fmt::v11::detail::do_format_base2e<char, unsigned int>(int, char*, unsigned int, int, bool) Line | Count | Source | 1331 | 16.1k | int size, bool upper = false) -> Char* { | 1332 | 16.1k | out += size; | 1333 | 94.4k | do { | 1334 | 94.4k | const char* digits = upper ? "0123456789ABCDEF" : "0123456789abcdef"; | 1335 | 94.4k | unsigned digit = static_cast<unsigned>(value & ((1 << base_bits) - 1)); | 1336 | 94.4k | *--out = static_cast<Char>(base_bits < 4 ? static_cast<char>('0' + digit) | 1337 | 94.4k | : digits[digit]); | 1338 | 94.4k | } while ((value >>= base_bits) != 0); | 1339 | 16.1k | return out; | 1340 | 16.1k | } |
char* fmt::v11::detail::do_format_base2e<char, unsigned __int128>(int, char*, unsigned __int128, int, bool) Line | Count | Source | 1331 | 5.71k | int size, bool upper = false) -> Char* { | 1332 | 5.71k | out += size; | 1333 | 79.4k | do { | 1334 | 79.4k | const char* digits = upper ? "0123456789ABCDEF" : "0123456789abcdef"; | 1335 | 79.4k | unsigned digit = static_cast<unsigned>(value & ((1 << base_bits) - 1)); | 1336 | 79.4k | *--out = static_cast<Char>(base_bits < 4 ? static_cast<char>('0' + digit) | 1337 | 79.4k | : digits[digit]); | 1338 | 79.4k | } while ((value >>= base_bits) != 0); | 1339 | 5.71k | return out; | 1340 | 5.71k | } |
char* fmt::v11::detail::do_format_base2e<char, unsigned long>(int, char*, unsigned long, int, bool) Line | Count | Source | 1331 | 28.9k | int size, bool upper = false) -> Char* { | 1332 | 28.9k | out += size; | 1333 | 428k | do { | 1334 | 428k | const char* digits = upper ? "0123456789ABCDEF" : "0123456789abcdef"; | 1335 | 428k | unsigned digit = static_cast<unsigned>(value & ((1 << base_bits) - 1)); | 1336 | 428k | *--out = static_cast<Char>(base_bits < 4 ? static_cast<char>('0' + digit) | 1337 | 428k | : digits[digit]); | 1338 | 428k | } while ((value >>= base_bits) != 0); | 1339 | 28.9k | return out; | 1340 | 28.9k | } |
|
1341 | | |
1342 | | // Formats an unsigned integer in the power of two base (binary, octal, hex). |
1343 | | template <typename Char, typename UInt> |
1344 | | FMT_CONSTEXPR auto format_base2e(int base_bits, Char* out, UInt value, |
1345 | 28.8k | int num_digits, bool upper = false) -> Char* { |
1346 | 28.8k | do_format_base2e(base_bits, out, value, num_digits, upper); |
1347 | 28.8k | return out + num_digits; |
1348 | 28.8k | } char* fmt::v11::detail::format_base2e<char, unsigned int>(int, char*, unsigned int, int, bool) Line | Count | Source | 1345 | 4.15k | int num_digits, bool upper = false) -> Char* { | 1346 | 4.15k | do_format_base2e(base_bits, out, value, num_digits, upper); | 1347 | 4.15k | return out + num_digits; | 1348 | 4.15k | } |
char* fmt::v11::detail::format_base2e<char, unsigned __int128>(int, char*, unsigned __int128, int, bool) Line | Count | Source | 1345 | 5.71k | int num_digits, bool upper = false) -> Char* { | 1346 | 5.71k | do_format_base2e(base_bits, out, value, num_digits, upper); | 1347 | 5.71k | return out + num_digits; | 1348 | 5.71k | } |
char* fmt::v11::detail::format_base2e<char, unsigned long>(int, char*, unsigned long, int, bool) Line | Count | Source | 1345 | 18.9k | int num_digits, bool upper = false) -> Char* { | 1346 | 18.9k | do_format_base2e(base_bits, out, value, num_digits, upper); | 1347 | 18.9k | return out + num_digits; | 1348 | 18.9k | } |
|
1349 | | |
1350 | | template <typename Char, typename OutputIt, typename UInt, |
1351 | | FMT_ENABLE_IF(is_back_insert_iterator<OutputIt>::value)> |
1352 | | FMT_CONSTEXPR inline auto format_base2e(int base_bits, OutputIt out, UInt value, |
1353 | | int num_digits, bool upper = false) |
1354 | 10.9k | -> OutputIt { |
1355 | 10.9k | if (auto ptr = to_pointer<Char>(out, to_unsigned(num_digits))) { |
1356 | 10.8k | format_base2e(base_bits, ptr, value, num_digits, upper); |
1357 | 10.8k | return out; |
1358 | 10.8k | } |
1359 | | // Make buffer large enough for any base. |
1360 | 98 | char buffer[num_bits<UInt>()]; |
1361 | 98 | if (is_constant_evaluated()) fill_n(buffer, sizeof(buffer), '\0'); |
1362 | 98 | format_base2e(base_bits, buffer, value, num_digits, upper); |
1363 | 98 | return detail::copy_noinline<Char>(buffer, buffer + num_digits, out); |
1364 | 10.9k | } _ZN3fmt3v116detail13format_base2eIcNS0_14basic_appenderIcEEmTnNSt3__19enable_ifIXsr23is_back_insert_iteratorIT0_EE5valueEiE4typeELi0EEES7_iS7_T1_ib Line | Count | Source | 1354 | 10.9k | -> OutputIt { | 1355 | 10.9k | if (auto ptr = to_pointer<Char>(out, to_unsigned(num_digits))) { | 1356 | 10.8k | format_base2e(base_bits, ptr, value, num_digits, upper); | 1357 | 10.8k | return out; | 1358 | 10.8k | } | 1359 | | // Make buffer large enough for any base. | 1360 | 98 | char buffer[num_bits<UInt>()]; | 1361 | 98 | if (is_constant_evaluated()) fill_n(buffer, sizeof(buffer), '\0'); | 1362 | 98 | format_base2e(base_bits, buffer, value, num_digits, upper); | 1363 | 98 | return detail::copy_noinline<Char>(buffer, buffer + num_digits, out); | 1364 | 10.9k | } |
Unexecuted instantiation: _ZN3fmt3v116detail13format_base2eIcNS0_14basic_appenderIcEEoTnNSt3__19enable_ifIXsr23is_back_insert_iteratorIT0_EE5valueEiE4typeELi0EEES7_iS7_T1_ib |
1365 | | |
1366 | | // A converter from UTF-8 to UTF-16. |
1367 | | class utf8_to_utf16 { |
1368 | | private: |
1369 | | basic_memory_buffer<wchar_t> buffer_; |
1370 | | |
1371 | | public: |
1372 | | FMT_API explicit utf8_to_utf16(string_view s); |
1373 | 0 | inline operator basic_string_view<wchar_t>() const { |
1374 | 0 | return {&buffer_[0], size()}; |
1375 | 0 | } |
1376 | 0 | inline auto size() const -> size_t { return buffer_.size() - 1; } |
1377 | 0 | inline auto c_str() const -> const wchar_t* { return &buffer_[0]; } |
1378 | 0 | inline auto str() const -> std::wstring { return {&buffer_[0], size()}; } |
1379 | | }; |
1380 | | |
1381 | | enum class to_utf8_error_policy { abort, replace }; |
1382 | | |
1383 | | // A converter from UTF-16/UTF-32 (host endian) to UTF-8. |
1384 | | template <typename WChar, typename Buffer = memory_buffer> class to_utf8 { |
1385 | | private: |
1386 | | Buffer buffer_; |
1387 | | |
1388 | | public: |
1389 | 0 | to_utf8() {} |
1390 | | explicit to_utf8(basic_string_view<WChar> s, |
1391 | | to_utf8_error_policy policy = to_utf8_error_policy::abort) { |
1392 | | static_assert(sizeof(WChar) == 2 || sizeof(WChar) == 4, |
1393 | | "Expect utf16 or utf32"); |
1394 | | if (!convert(s, policy)) |
1395 | | FMT_THROW(std::runtime_error(sizeof(WChar) == 2 ? "invalid utf16" |
1396 | | : "invalid utf32")); |
1397 | | } |
1398 | | operator string_view() const { return string_view(&buffer_[0], size()); } |
1399 | 0 | auto size() const -> size_t { return buffer_.size() - 1; } |
1400 | 0 | auto c_str() const -> const char* { return &buffer_[0]; } |
1401 | | auto str() const -> std::string { return std::string(&buffer_[0], size()); } |
1402 | | |
1403 | | // Performs conversion returning a bool instead of throwing exception on |
1404 | | // conversion error. This method may still throw in case of memory allocation |
1405 | | // error. |
1406 | | auto convert(basic_string_view<WChar> s, |
1407 | | to_utf8_error_policy policy = to_utf8_error_policy::abort) |
1408 | 0 | -> bool { |
1409 | 0 | if (!convert(buffer_, s, policy)) return false; |
1410 | 0 | buffer_.push_back(0); |
1411 | 0 | return true; |
1412 | 0 | } |
1413 | | static auto convert(Buffer& buf, basic_string_view<WChar> s, |
1414 | | to_utf8_error_policy policy = to_utf8_error_policy::abort) |
1415 | 0 | -> bool { |
1416 | 0 | for (auto p = s.begin(); p != s.end(); ++p) { |
1417 | 0 | uint32_t c = static_cast<uint32_t>(*p); |
1418 | 0 | if (sizeof(WChar) == 2 && c >= 0xd800 && c <= 0xdfff) { |
1419 | | // Handle a surrogate pair. |
1420 | 0 | ++p; |
1421 | 0 | if (p == s.end() || (c & 0xfc00) != 0xd800 || (*p & 0xfc00) != 0xdc00) { |
1422 | 0 | if (policy == to_utf8_error_policy::abort) return false; |
1423 | 0 | buf.append(string_view("\xEF\xBF\xBD")); |
1424 | 0 | --p; |
1425 | 0 | continue; |
1426 | 0 | } else { |
1427 | 0 | c = (c << 10) + static_cast<uint32_t>(*p) - 0x35fdc00; |
1428 | 0 | } |
1429 | 0 | } |
1430 | 0 | if (c < 0x80) { |
1431 | 0 | buf.push_back(static_cast<char>(c)); |
1432 | 0 | } else if (c < 0x800) { |
1433 | 0 | buf.push_back(static_cast<char>(0xc0 | (c >> 6))); |
1434 | 0 | buf.push_back(static_cast<char>(0x80 | (c & 0x3f))); |
1435 | 0 | } else if ((c >= 0x800 && c <= 0xd7ff) || (c >= 0xe000 && c <= 0xffff)) { |
1436 | 0 | buf.push_back(static_cast<char>(0xe0 | (c >> 12))); |
1437 | 0 | buf.push_back(static_cast<char>(0x80 | ((c & 0xfff) >> 6))); |
1438 | 0 | buf.push_back(static_cast<char>(0x80 | (c & 0x3f))); |
1439 | 0 | } else if (c >= 0x10000 && c <= 0x10ffff) { |
1440 | 0 | buf.push_back(static_cast<char>(0xf0 | (c >> 18))); |
1441 | 0 | buf.push_back(static_cast<char>(0x80 | ((c & 0x3ffff) >> 12))); |
1442 | 0 | buf.push_back(static_cast<char>(0x80 | ((c & 0xfff) >> 6))); |
1443 | 0 | buf.push_back(static_cast<char>(0x80 | (c & 0x3f))); |
1444 | 0 | } else { |
1445 | 0 | return false; |
1446 | 0 | } |
1447 | 0 | } |
1448 | 0 | return true; |
1449 | 0 | } |
1450 | | }; |
1451 | | |
1452 | | // Computes 128-bit result of multiplication of two 64-bit unsigned integers. |
1453 | 551k | inline auto umul128(uint64_t x, uint64_t y) noexcept -> uint128_fallback { |
1454 | 551k | #if FMT_USE_INT128 |
1455 | 551k | auto p = static_cast<uint128_opt>(x) * static_cast<uint128_opt>(y); |
1456 | 551k | return {static_cast<uint64_t>(p >> 64), static_cast<uint64_t>(p)}; |
1457 | | #elif defined(_MSC_VER) && defined(_M_X64) |
1458 | | auto hi = uint64_t(); |
1459 | | auto lo = _umul128(x, y, &hi); |
1460 | | return {hi, lo}; |
1461 | | #else |
1462 | | const uint64_t mask = static_cast<uint64_t>(max_value<uint32_t>()); |
1463 | | |
1464 | | uint64_t a = x >> 32; |
1465 | | uint64_t b = x & mask; |
1466 | | uint64_t c = y >> 32; |
1467 | | uint64_t d = y & mask; |
1468 | | |
1469 | | uint64_t ac = a * c; |
1470 | | uint64_t bc = b * c; |
1471 | | uint64_t ad = a * d; |
1472 | | uint64_t bd = b * d; |
1473 | | |
1474 | | uint64_t intermediate = (bd >> 32) + (ad & mask) + (bc & mask); |
1475 | | |
1476 | | return {ac + (intermediate >> 32) + (ad >> 32) + (bc >> 32), |
1477 | | (intermediate << 32) + (bd & mask)}; |
1478 | | #endif |
1479 | 551k | } |
1480 | | |
1481 | | namespace dragonbox { |
1482 | | // Computes floor(log10(pow(2, e))) for e in [-2620, 2620] using the method from |
1483 | | // https://fmt.dev/papers/Dragonbox.pdf#page=28, section 6.1. |
1484 | 196k | inline auto floor_log10_pow2(int e) noexcept -> int { |
1485 | 196k | FMT_ASSERT(e <= 2620 && e >= -2620, "too large exponent"); |
1486 | 196k | static_assert((-1 >> 1) == -1, "right shift is not arithmetic"); |
1487 | 196k | return (e * 315653) >> 20; |
1488 | 196k | } |
1489 | | |
1490 | 564k | inline auto floor_log2_pow10(int e) noexcept -> int { |
1491 | 564k | FMT_ASSERT(e <= 1233 && e >= -1233, "too large exponent"); |
1492 | 564k | return (e * 1741647) >> 19; |
1493 | 564k | } |
1494 | | |
1495 | | // Computes upper 64 bits of multiplication of two 64-bit unsigned integers. |
1496 | 304k | inline auto umul128_upper64(uint64_t x, uint64_t y) noexcept -> uint64_t { |
1497 | 304k | #if FMT_USE_INT128 |
1498 | 304k | auto p = static_cast<uint128_opt>(x) * static_cast<uint128_opt>(y); |
1499 | 304k | return static_cast<uint64_t>(p >> 64); |
1500 | | #elif defined(_MSC_VER) && defined(_M_X64) |
1501 | | return __umulh(x, y); |
1502 | | #else |
1503 | | return umul128(x, y).high(); |
1504 | | #endif |
1505 | 304k | } |
1506 | | |
1507 | | // Computes upper 128 bits of multiplication of a 64-bit unsigned integer and a |
1508 | | // 128-bit unsigned integer. |
1509 | | inline auto umul192_upper128(uint64_t x, uint128_fallback y) noexcept |
1510 | 174k | -> uint128_fallback { |
1511 | 174k | uint128_fallback r = umul128(x, y.high()); |
1512 | 174k | r += umul128_upper64(x, y.low()); |
1513 | 174k | return r; |
1514 | 174k | } |
1515 | | |
1516 | | FMT_API auto get_cached_power(int k) noexcept -> uint128_fallback; |
1517 | | |
1518 | | // Type-specific information that Dragonbox uses. |
1519 | | template <typename T, typename Enable = void> struct float_info; |
1520 | | |
1521 | | template <> struct float_info<float> { |
1522 | | using carrier_uint = uint32_t; |
1523 | | static const int exponent_bits = 8; |
1524 | | static const int kappa = 1; |
1525 | | static const int big_divisor = 100; |
1526 | | static const int small_divisor = 10; |
1527 | | static const int min_k = -31; |
1528 | | static const int max_k = 46; |
1529 | | static const int shorter_interval_tie_lower_threshold = -35; |
1530 | | static const int shorter_interval_tie_upper_threshold = -35; |
1531 | | }; |
1532 | | |
1533 | | template <> struct float_info<double> { |
1534 | | using carrier_uint = uint64_t; |
1535 | | static const int exponent_bits = 11; |
1536 | | static const int kappa = 2; |
1537 | | static const int big_divisor = 1000; |
1538 | | static const int small_divisor = 100; |
1539 | | static const int min_k = -292; |
1540 | | static const int max_k = 341; |
1541 | | static const int shorter_interval_tie_lower_threshold = -77; |
1542 | | static const int shorter_interval_tie_upper_threshold = -77; |
1543 | | }; |
1544 | | |
1545 | | // An 80- or 128-bit floating point number. |
1546 | | template <typename T> |
1547 | | struct float_info<T, enable_if_t<std::numeric_limits<T>::digits == 64 || |
1548 | | std::numeric_limits<T>::digits == 113 || |
1549 | | is_float128<T>::value>> { |
1550 | | using carrier_uint = detail::uint128_t; |
1551 | | static const int exponent_bits = 15; |
1552 | | }; |
1553 | | |
1554 | | // A double-double floating point number. |
1555 | | template <typename T> |
1556 | | struct float_info<T, enable_if_t<is_double_double<T>::value>> { |
1557 | | using carrier_uint = detail::uint128_t; |
1558 | | }; |
1559 | | |
1560 | | template <typename T> struct decimal_fp { |
1561 | | using significand_type = typename float_info<T>::carrier_uint; |
1562 | | significand_type significand; |
1563 | | int exponent; |
1564 | | }; |
1565 | | |
1566 | | template <typename T> FMT_API auto to_decimal(T x) noexcept -> decimal_fp<T>; |
1567 | | } // namespace dragonbox |
1568 | | |
1569 | | // Returns true iff Float has the implicit bit which is not stored. |
1570 | 0 | template <typename Float> constexpr auto has_implicit_bit() -> bool { |
1571 | 0 | // An 80-bit FP number has a 64-bit significand an no implicit bit. |
1572 | 0 | return std::numeric_limits<Float>::digits != 64; |
1573 | 0 | } Unexecuted instantiation: bool fmt::v11::detail::has_implicit_bit<double>() Unexecuted instantiation: bool fmt::v11::detail::has_implicit_bit<float>() Unexecuted instantiation: bool fmt::v11::detail::has_implicit_bit<long double>() |
1574 | | |
1575 | | // Returns the number of significand bits stored in Float. The implicit bit is |
1576 | | // not counted since it is not stored. |
1577 | 1.18M | template <typename Float> constexpr auto num_significand_bits() -> int { |
1578 | | // std::numeric_limits may not support __float128. |
1579 | 1.18M | return is_float128<Float>() ? 112 |
1580 | 1.18M | : (std::numeric_limits<Float>::digits - |
1581 | 1.18M | (has_implicit_bit<Float>() ? 1 : 0)); |
1582 | 1.18M | } int fmt::v11::detail::num_significand_bits<double>() Line | Count | Source | 1577 | 808k | template <typename Float> constexpr auto num_significand_bits() -> int { | 1578 | | // std::numeric_limits may not support __float128. | 1579 | 808k | return is_float128<Float>() ? 112 | 1580 | 808k | : (std::numeric_limits<Float>::digits - | 1581 | 808k | (has_implicit_bit<Float>() ? 1 : 0)); | 1582 | 808k | } |
int fmt::v11::detail::num_significand_bits<float>() Line | Count | Source | 1577 | 174k | template <typename Float> constexpr auto num_significand_bits() -> int { | 1578 | | // std::numeric_limits may not support __float128. | 1579 | 174k | return is_float128<Float>() ? 112 | 1580 | 174k | : (std::numeric_limits<Float>::digits - | 1581 | 174k | (has_implicit_bit<Float>() ? 1 : 0)); | 1582 | 174k | } |
int fmt::v11::detail::num_significand_bits<long double>() Line | Count | Source | 1577 | 199k | template <typename Float> constexpr auto num_significand_bits() -> int { | 1578 | | // std::numeric_limits may not support __float128. | 1579 | 199k | return is_float128<Float>() ? 112 | 1580 | 199k | : (std::numeric_limits<Float>::digits - | 1581 | 199k | (has_implicit_bit<Float>() ? 1 : 0)); | 1582 | 199k | } |
|
1583 | | |
1584 | | template <typename Float> |
1585 | | constexpr auto exponent_mask() -> |
1586 | 480k | typename dragonbox::float_info<Float>::carrier_uint { |
1587 | 480k | using float_uint = typename dragonbox::float_info<Float>::carrier_uint; |
1588 | 480k | return ((float_uint(1) << dragonbox::float_info<Float>::exponent_bits) - 1) |
1589 | 480k | << num_significand_bits<Float>(); |
1590 | 480k | } fmt::v11::detail::dragonbox::float_info<double, void>::carrier_uint fmt::v11::detail::exponent_mask<double>() Line | Count | Source | 1586 | 223k | typename dragonbox::float_info<Float>::carrier_uint { | 1587 | 223k | using float_uint = typename dragonbox::float_info<Float>::carrier_uint; | 1588 | 223k | return ((float_uint(1) << dragonbox::float_info<Float>::exponent_bits) - 1) | 1589 | 223k | << num_significand_bits<Float>(); | 1590 | 223k | } |
fmt::v11::detail::dragonbox::float_info<float, void>::carrier_uint fmt::v11::detail::exponent_mask<float>() Line | Count | Source | 1586 | 57.7k | typename dragonbox::float_info<Float>::carrier_uint { | 1587 | 57.7k | using float_uint = typename dragonbox::float_info<Float>::carrier_uint; | 1588 | 57.7k | return ((float_uint(1) << dragonbox::float_info<Float>::exponent_bits) - 1) | 1589 | 57.7k | << num_significand_bits<Float>(); | 1590 | 57.7k | } |
fmt::v11::detail::dragonbox::float_info<long double, void>::carrier_uint fmt::v11::detail::exponent_mask<long double>() Line | Count | Source | 1586 | 199k | typename dragonbox::float_info<Float>::carrier_uint { | 1587 | 199k | using float_uint = typename dragonbox::float_info<Float>::carrier_uint; | 1588 | 199k | return ((float_uint(1) << dragonbox::float_info<Float>::exponent_bits) - 1) | 1589 | 199k | << num_significand_bits<Float>(); | 1590 | 199k | } |
|
1591 | 416k | template <typename Float> constexpr auto exponent_bias() -> int { |
1592 | | // std::numeric_limits may not support __float128. |
1593 | 416k | return is_float128<Float>() ? 16383 |
1594 | 416k | : std::numeric_limits<Float>::max_exponent - 1; |
1595 | 416k | } int fmt::v11::detail::exponent_bias<double>() Line | Count | Source | 1591 | 182k | template <typename Float> constexpr auto exponent_bias() -> int { | 1592 | | // std::numeric_limits may not support __float128. | 1593 | 182k | return is_float128<Float>() ? 16383 | 1594 | 182k | : std::numeric_limits<Float>::max_exponent - 1; | 1595 | 182k | } |
int fmt::v11::detail::exponent_bias<float>() Line | Count | Source | 1591 | 34.0k | template <typename Float> constexpr auto exponent_bias() -> int { | 1592 | | // std::numeric_limits may not support __float128. | 1593 | 34.0k | return is_float128<Float>() ? 16383 | 1594 | 34.0k | : std::numeric_limits<Float>::max_exponent - 1; | 1595 | 34.0k | } |
int fmt::v11::detail::exponent_bias<long double>() Line | Count | Source | 1591 | 199k | template <typename Float> constexpr auto exponent_bias() -> int { | 1592 | | // std::numeric_limits may not support __float128. | 1593 | 199k | return is_float128<Float>() ? 16383 | 1594 | 199k | : std::numeric_limits<Float>::max_exponent - 1; | 1595 | 199k | } |
|
1596 | | |
1597 | | // Writes the exponent exp in the form "[+-]d{2,3}" to buffer. |
1598 | | template <typename Char, typename OutputIt> |
1599 | 96.3k | FMT_CONSTEXPR auto write_exponent(int exp, OutputIt out) -> OutputIt { |
1600 | 96.3k | FMT_ASSERT(-10000 < exp && exp < 10000, "exponent out of range"); |
1601 | 96.3k | if (exp < 0) { |
1602 | 59.9k | *out++ = static_cast<Char>('-'); |
1603 | 59.9k | exp = -exp; |
1604 | 59.9k | } else { |
1605 | 36.4k | *out++ = static_cast<Char>('+'); |
1606 | 36.4k | } |
1607 | 96.3k | auto uexp = static_cast<uint32_t>(exp); |
1608 | 96.3k | if (is_constant_evaluated()) { |
1609 | 0 | if (uexp < 10) *out++ = '0'; |
1610 | 0 | return format_decimal<Char>(out, uexp, count_digits(uexp)); |
1611 | 0 | } |
1612 | 96.3k | if (uexp >= 100u) { |
1613 | 53.6k | const char* top = digits2(uexp / 100); |
1614 | 53.6k | if (uexp >= 1000u) *out++ = static_cast<Char>(top[0]); |
1615 | 53.6k | *out++ = static_cast<Char>(top[1]); |
1616 | 53.6k | uexp %= 100; |
1617 | 53.6k | } |
1618 | 96.3k | const char* d = digits2(uexp); |
1619 | 96.3k | *out++ = static_cast<Char>(d[0]); |
1620 | 96.3k | *out++ = static_cast<Char>(d[1]); |
1621 | 96.3k | return out; |
1622 | 96.3k | } |
1623 | | |
1624 | | // A floating-point number f * pow(2, e) where F is an unsigned type. |
1625 | | template <typename F> struct basic_fp { |
1626 | | F f; |
1627 | | int e; |
1628 | | |
1629 | | static constexpr const int num_significand_bits = |
1630 | | static_cast<int>(sizeof(F) * num_bits<unsigned char>()); |
1631 | | |
1632 | 114k | constexpr basic_fp() : f(0), e(0) {} |
1633 | | constexpr basic_fp(uint64_t f_val, int e_val) : f(f_val), e(e_val) {} |
1634 | | |
1635 | | // Constructs fp from an IEEE754 floating-point number. |
1636 | 110k | template <typename Float> FMT_CONSTEXPR basic_fp(Float n) { assign(n); } fmt::v11::detail::basic_fp<unsigned __int128>::basic_fp<long double>(long double) Line | Count | Source | 1636 | 102k | template <typename Float> FMT_CONSTEXPR basic_fp(Float n) { assign(n); } |
fmt::v11::detail::basic_fp<unsigned long>::basic_fp<double>(double) Line | Count | Source | 1636 | 8.01k | template <typename Float> FMT_CONSTEXPR basic_fp(Float n) { assign(n); } |
|
1637 | | |
1638 | | // Assigns n to this and return true iff predecessor is closer than successor. |
1639 | | template <typename Float, FMT_ENABLE_IF(!is_double_double<Float>::value)> |
1640 | 225k | FMT_CONSTEXPR auto assign(Float n) -> bool { |
1641 | 225k | static_assert(std::numeric_limits<Float>::digits <= 113, "unsupported FP"); |
1642 | | // Assume Float is in the format [sign][exponent][significand]. |
1643 | 225k | using carrier_uint = typename dragonbox::float_info<Float>::carrier_uint; |
1644 | 225k | const auto num_float_significand_bits = |
1645 | 225k | detail::num_significand_bits<Float>(); |
1646 | 225k | const auto implicit_bit = carrier_uint(1) << num_float_significand_bits; |
1647 | 225k | const auto significand_mask = implicit_bit - 1; |
1648 | 225k | auto u = bit_cast<carrier_uint>(n); |
1649 | 225k | f = static_cast<F>(u & significand_mask); |
1650 | 225k | auto biased_e = static_cast<int>((u & exponent_mask<Float>()) >> |
1651 | 225k | num_float_significand_bits); |
1652 | | // The predecessor is closer if n is a normalized power of 2 (f == 0) |
1653 | | // other than the smallest normalized number (biased_e > 1). |
1654 | 225k | auto is_predecessor_closer = f == 0 && biased_e > 1; |
1655 | 225k | if (biased_e == 0) |
1656 | 47.3k | biased_e = 1; // Subnormals use biased exponent 1 (min exponent). |
1657 | 177k | else if (has_implicit_bit<Float>()) |
1658 | 21.7k | f += static_cast<F>(implicit_bit); |
1659 | 225k | e = biased_e - exponent_bias<Float>() - num_float_significand_bits; |
1660 | 225k | if (!has_implicit_bit<Float>()) ++e; |
1661 | 225k | return is_predecessor_closer; |
1662 | 225k | } _ZN3fmt3v116detail8basic_fpIoE6assignIfTnNSt3__19enable_ifIXntsr16is_double_doubleIT_EE5valueEiE4typeELi0EEEbS7_ Line | Count | Source | 1640 | 7.81k | FMT_CONSTEXPR auto assign(Float n) -> bool { | 1641 | 7.81k | static_assert(std::numeric_limits<Float>::digits <= 113, "unsupported FP"); | 1642 | | // Assume Float is in the format [sign][exponent][significand]. | 1643 | 7.81k | using carrier_uint = typename dragonbox::float_info<Float>::carrier_uint; | 1644 | 7.81k | const auto num_float_significand_bits = | 1645 | 7.81k | detail::num_significand_bits<Float>(); | 1646 | 7.81k | const auto implicit_bit = carrier_uint(1) << num_float_significand_bits; | 1647 | 7.81k | const auto significand_mask = implicit_bit - 1; | 1648 | 7.81k | auto u = bit_cast<carrier_uint>(n); | 1649 | 7.81k | f = static_cast<F>(u & significand_mask); | 1650 | 7.81k | auto biased_e = static_cast<int>((u & exponent_mask<Float>()) >> | 1651 | 7.81k | num_float_significand_bits); | 1652 | | // The predecessor is closer if n is a normalized power of 2 (f == 0) | 1653 | | // other than the smallest normalized number (biased_e > 1). | 1654 | 7.81k | auto is_predecessor_closer = f == 0 && biased_e > 1; | 1655 | 7.81k | if (biased_e == 0) | 1656 | 1.14k | biased_e = 1; // Subnormals use biased exponent 1 (min exponent). | 1657 | 6.67k | else if (has_implicit_bit<Float>()) | 1658 | 6.67k | f += static_cast<F>(implicit_bit); | 1659 | 7.81k | e = biased_e - exponent_bias<Float>() - num_float_significand_bits; | 1660 | 7.81k | if (!has_implicit_bit<Float>()) ++e; | 1661 | 7.81k | return is_predecessor_closer; | 1662 | 7.81k | } |
_ZN3fmt3v116detail8basic_fpIoE6assignIeTnNSt3__19enable_ifIXntsr16is_double_doubleIT_EE5valueEiE4typeELi0EEEbS7_ Line | Count | Source | 1640 | 199k | FMT_CONSTEXPR auto assign(Float n) -> bool { | 1641 | 199k | static_assert(std::numeric_limits<Float>::digits <= 113, "unsupported FP"); | 1642 | | // Assume Float is in the format [sign][exponent][significand]. | 1643 | 199k | using carrier_uint = typename dragonbox::float_info<Float>::carrier_uint; | 1644 | 199k | const auto num_float_significand_bits = | 1645 | 199k | detail::num_significand_bits<Float>(); | 1646 | 199k | const auto implicit_bit = carrier_uint(1) << num_float_significand_bits; | 1647 | 199k | const auto significand_mask = implicit_bit - 1; | 1648 | 199k | auto u = bit_cast<carrier_uint>(n); | 1649 | 199k | f = static_cast<F>(u & significand_mask); | 1650 | 199k | auto biased_e = static_cast<int>((u & exponent_mask<Float>()) >> | 1651 | 199k | num_float_significand_bits); | 1652 | | // The predecessor is closer if n is a normalized power of 2 (f == 0) | 1653 | | // other than the smallest normalized number (biased_e > 1). | 1654 | 199k | auto is_predecessor_closer = f == 0 && biased_e > 1; | 1655 | 199k | if (biased_e == 0) | 1656 | 43.4k | biased_e = 1; // Subnormals use biased exponent 1 (min exponent). | 1657 | 155k | else if (has_implicit_bit<Float>()) | 1658 | 0 | f += static_cast<F>(implicit_bit); | 1659 | 199k | e = biased_e - exponent_bias<Float>() - num_float_significand_bits; | 1660 | 199k | if (!has_implicit_bit<Float>()) ++e; | 1661 | 199k | return is_predecessor_closer; | 1662 | 199k | } |
_ZN3fmt3v116detail8basic_fpImE6assignIdTnNSt3__19enable_ifIXntsr16is_double_doubleIT_EE5valueEiE4typeELi0EEEbS7_ Line | Count | Source | 1640 | 8.01k | FMT_CONSTEXPR auto assign(Float n) -> bool { | 1641 | 8.01k | static_assert(std::numeric_limits<Float>::digits <= 113, "unsupported FP"); | 1642 | | // Assume Float is in the format [sign][exponent][significand]. | 1643 | 8.01k | using carrier_uint = typename dragonbox::float_info<Float>::carrier_uint; | 1644 | 8.01k | const auto num_float_significand_bits = | 1645 | 8.01k | detail::num_significand_bits<Float>(); | 1646 | 8.01k | const auto implicit_bit = carrier_uint(1) << num_float_significand_bits; | 1647 | 8.01k | const auto significand_mask = implicit_bit - 1; | 1648 | 8.01k | auto u = bit_cast<carrier_uint>(n); | 1649 | 8.01k | f = static_cast<F>(u & significand_mask); | 1650 | 8.01k | auto biased_e = static_cast<int>((u & exponent_mask<Float>()) >> | 1651 | 8.01k | num_float_significand_bits); | 1652 | | // The predecessor is closer if n is a normalized power of 2 (f == 0) | 1653 | | // other than the smallest normalized number (biased_e > 1). | 1654 | 8.01k | auto is_predecessor_closer = f == 0 && biased_e > 1; | 1655 | 8.01k | if (biased_e == 0) | 1656 | 1.36k | biased_e = 1; // Subnormals use biased exponent 1 (min exponent). | 1657 | 6.65k | else if (has_implicit_bit<Float>()) | 1658 | 6.65k | f += static_cast<F>(implicit_bit); | 1659 | 8.01k | e = biased_e - exponent_bias<Float>() - num_float_significand_bits; | 1660 | 8.01k | if (!has_implicit_bit<Float>()) ++e; | 1661 | 8.01k | return is_predecessor_closer; | 1662 | 8.01k | } |
_ZN3fmt3v116detail8basic_fpIoE6assignIdTnNSt3__19enable_ifIXntsr16is_double_doubleIT_EE5valueEiE4typeELi0EEEbS7_ Line | Count | Source | 1640 | 9.79k | FMT_CONSTEXPR auto assign(Float n) -> bool { | 1641 | 9.79k | static_assert(std::numeric_limits<Float>::digits <= 113, "unsupported FP"); | 1642 | | // Assume Float is in the format [sign][exponent][significand]. | 1643 | 9.79k | using carrier_uint = typename dragonbox::float_info<Float>::carrier_uint; | 1644 | 9.79k | const auto num_float_significand_bits = | 1645 | 9.79k | detail::num_significand_bits<Float>(); | 1646 | 9.79k | const auto implicit_bit = carrier_uint(1) << num_float_significand_bits; | 1647 | 9.79k | const auto significand_mask = implicit_bit - 1; | 1648 | 9.79k | auto u = bit_cast<carrier_uint>(n); | 1649 | 9.79k | f = static_cast<F>(u & significand_mask); | 1650 | 9.79k | auto biased_e = static_cast<int>((u & exponent_mask<Float>()) >> | 1651 | 9.79k | num_float_significand_bits); | 1652 | | // The predecessor is closer if n is a normalized power of 2 (f == 0) | 1653 | | // other than the smallest normalized number (biased_e > 1). | 1654 | 9.79k | auto is_predecessor_closer = f == 0 && biased_e > 1; | 1655 | 9.79k | if (biased_e == 0) | 1656 | 1.37k | biased_e = 1; // Subnormals use biased exponent 1 (min exponent). | 1657 | 8.42k | else if (has_implicit_bit<Float>()) | 1658 | 8.42k | f += static_cast<F>(implicit_bit); | 1659 | 9.79k | e = biased_e - exponent_bias<Float>() - num_float_significand_bits; | 1660 | 9.79k | if (!has_implicit_bit<Float>()) ++e; | 1661 | 9.79k | return is_predecessor_closer; | 1662 | 9.79k | } |
|
1663 | | |
1664 | | template <typename Float, FMT_ENABLE_IF(is_double_double<Float>::value)> |
1665 | | FMT_CONSTEXPR auto assign(Float n) -> bool { |
1666 | | static_assert(std::numeric_limits<double>::is_iec559, "unsupported FP"); |
1667 | | return assign(static_cast<double>(n)); |
1668 | | } |
1669 | | }; |
1670 | | |
1671 | | using fp = basic_fp<unsigned long long>; |
1672 | | |
1673 | | // Normalizes the value converted from double and multiplied by (1 << SHIFT). |
1674 | | template <int SHIFT = 0, typename F> |
1675 | | FMT_CONSTEXPR auto normalize(basic_fp<F> value) -> basic_fp<F> { |
1676 | | // Handle subnormals. |
1677 | | const auto implicit_bit = F(1) << num_significand_bits<double>(); |
1678 | | const auto shifted_implicit_bit = implicit_bit << SHIFT; |
1679 | | while ((value.f & shifted_implicit_bit) == 0) { |
1680 | | value.f <<= 1; |
1681 | | --value.e; |
1682 | | } |
1683 | | // Subtract 1 to account for hidden bit. |
1684 | | const auto offset = basic_fp<F>::num_significand_bits - |
1685 | | num_significand_bits<double>() - SHIFT - 1; |
1686 | | value.f <<= offset; |
1687 | | value.e -= offset; |
1688 | | return value; |
1689 | | } |
1690 | | |
1691 | | // Computes lhs * rhs / pow(2, 64) rounded to nearest with half-up tie breaking. |
1692 | 0 | FMT_CONSTEXPR inline auto multiply(uint64_t lhs, uint64_t rhs) -> uint64_t { |
1693 | 0 | #if FMT_USE_INT128 |
1694 | 0 | auto product = static_cast<__uint128_t>(lhs) * rhs; |
1695 | 0 | auto f = static_cast<uint64_t>(product >> 64); |
1696 | 0 | return (static_cast<uint64_t>(product) & (1ULL << 63)) != 0 ? f + 1 : f; |
1697 | 0 | #else |
1698 | 0 | // Multiply 32-bit parts of significands. |
1699 | 0 | uint64_t mask = (1ULL << 32) - 1; |
1700 | 0 | uint64_t a = lhs >> 32, b = lhs & mask; |
1701 | 0 | uint64_t c = rhs >> 32, d = rhs & mask; |
1702 | 0 | uint64_t ac = a * c, bc = b * c, ad = a * d, bd = b * d; |
1703 | 0 | // Compute mid 64-bit of result and round. |
1704 | 0 | uint64_t mid = (bd >> 32) + (ad & mask) + (bc & mask) + (1U << 31); |
1705 | 0 | return ac + (ad >> 32) + (bc >> 32) + (mid >> 32); |
1706 | 0 | #endif |
1707 | 0 | } |
1708 | | |
1709 | 0 | FMT_CONSTEXPR inline auto operator*(fp x, fp y) -> fp { |
1710 | 0 | return {multiply(x.f, y.f), x.e + y.e + 64}; |
1711 | 0 | } |
1712 | | |
1713 | | template <typename T, bool doublish = num_bits<T>() == num_bits<double>()> |
1714 | | using convert_float_result = |
1715 | | conditional_t<std::is_same<T, float>::value || doublish, double, T>; |
1716 | | |
1717 | | template <typename T> |
1718 | 567k | constexpr auto convert_float(T value) -> convert_float_result<T> { |
1719 | 567k | return static_cast<convert_float_result<T>>(value); |
1720 | 567k | } _ZN3fmt3v116detail13convert_floatIeEENSt3__111conditionalIXoosr3std7is_sameIT_fEE5valueeqcl8num_bitsIS5_EEclL_ZNS1_8num_bitsIdEEivEEEdS5_E4typeES5_ Line | Count | Source | 1718 | 223k | constexpr auto convert_float(T value) -> convert_float_result<T> { | 1719 | 223k | return static_cast<convert_float_result<T>>(value); | 1720 | 223k | } |
_ZN3fmt3v116detail13convert_floatIfEENSt3__111conditionalIXoosr3std7is_sameIT_fEE5valueeqcl8num_bitsIS5_EEclL_ZNS1_8num_bitsIdEEivEEEdS5_E4typeES5_ Line | Count | Source | 1718 | 86.4k | constexpr auto convert_float(T value) -> convert_float_result<T> { | 1719 | 86.4k | return static_cast<convert_float_result<T>>(value); | 1720 | 86.4k | } |
_ZN3fmt3v116detail13convert_floatIdEENSt3__111conditionalIXoosr3std7is_sameIT_fEE5valueeqcl8num_bitsIS5_EEclL_ZNS1_8num_bitsIdEEivEEEdS5_E4typeES5_ Line | Count | Source | 1718 | 257k | constexpr auto convert_float(T value) -> convert_float_result<T> { | 1719 | 257k | return static_cast<convert_float_result<T>>(value); | 1720 | 257k | } |
|
1721 | | |
1722 | | template <typename Char, typename OutputIt> |
1723 | | FMT_NOINLINE FMT_CONSTEXPR auto fill(OutputIt it, size_t n, |
1724 | 54.5k | const basic_specs& specs) -> OutputIt { |
1725 | 54.5k | auto fill_size = specs.fill_size(); |
1726 | 54.5k | if (fill_size == 1) return detail::fill_n(it, n, specs.fill_unit<Char>()); |
1727 | 1.98k | if (const Char* data = specs.fill<Char>()) { |
1728 | 217k | for (size_t i = 0; i < n; ++i) it = copy<Char>(data, data + fill_size, it); |
1729 | 1.98k | } |
1730 | 1.98k | return it; |
1731 | 54.5k | } |
1732 | | |
1733 | | // Writes the output of f, padded according to format specifications in specs. |
1734 | | // size: output size in code units. |
1735 | | // width: output display width in (terminal) column positions. |
1736 | | template <typename Char, align default_align = align::left, typename OutputIt, |
1737 | | typename F> |
1738 | | FMT_CONSTEXPR auto write_padded(OutputIt out, const format_specs& specs, |
1739 | 683k | size_t size, size_t width, F&& f) -> OutputIt { |
1740 | 683k | static_assert(default_align == align::left || default_align == align::right, |
1741 | 683k | ""); |
1742 | 683k | unsigned spec_width = to_unsigned(specs.width); |
1743 | 683k | size_t padding = spec_width > width ? spec_width - width : 0; |
1744 | | // Shifts are encoded as string literals because static constexpr is not |
1745 | | // supported in constexpr functions. |
1746 | 683k | auto* shifts = |
1747 | 683k | default_align == align::left ? "\x1f\x1f\x00\x01" : "\x00\x1f\x00\x01"; |
1748 | 683k | size_t left_padding = padding >> shifts[static_cast<int>(specs.align())]; |
1749 | 683k | size_t right_padding = padding - left_padding; |
1750 | 683k | auto it = reserve(out, size + padding * specs.fill_size()); |
1751 | 683k | if (left_padding != 0) it = fill<Char>(it, left_padding, specs); |
1752 | 683k | it = f(it); |
1753 | 683k | if (right_padding != 0) it = fill<Char>(it, right_padding, specs); |
1754 | 683k | return base_iterator(out, it); |
1755 | 683k | } fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)1, fmt::v11::basic_appender<char>, fmt::v11::detail::write_char<char, fmt::v11::basic_appender<char> >(fmt::v11::basic_appender<char>, char, fmt::v11::format_specs const&)::{lambda(fmt::v11::basic_appender<char>)#1}&>(fmt::v11::detail::write_char<char, fmt::v11::basic_appender<char> >(fmt::v11::basic_appender<char>, char, fmt::v11::format_specs const&)::{lambda(fmt::v11::basic_appender<char>)#1}&, fmt::v11::format_specs const&, unsigned long, unsigned long, fmt::v11::detail::write_char<char, fmt::v11::basic_appender<char> >(fmt::v11::basic_appender<char>, char, fmt::v11::format_specs const&)::{lambda(fmt::v11::basic_appender<char>)#1}&) Line | Count | Source | 1739 | 17.9k | size_t size, size_t width, F&& f) -> OutputIt { | 1740 | 17.9k | static_assert(default_align == align::left || default_align == align::right, | 1741 | 17.9k | ""); | 1742 | 17.9k | unsigned spec_width = to_unsigned(specs.width); | 1743 | 17.9k | size_t padding = spec_width > width ? spec_width - width : 0; | 1744 | | // Shifts are encoded as string literals because static constexpr is not | 1745 | | // supported in constexpr functions. | 1746 | 17.9k | auto* shifts = | 1747 | 17.9k | default_align == align::left ? "\x1f\x1f\x00\x01" : "\x00\x1f\x00\x01"; | 1748 | 17.9k | size_t left_padding = padding >> shifts[static_cast<int>(specs.align())]; | 1749 | 17.9k | size_t right_padding = padding - left_padding; | 1750 | 17.9k | auto it = reserve(out, size + padding * specs.fill_size()); | 1751 | 17.9k | if (left_padding != 0) it = fill<Char>(it, left_padding, specs); | 1752 | 17.9k | it = f(it); | 1753 | 17.9k | if (right_padding != 0) it = fill<Char>(it, right_padding, specs); | 1754 | 17.9k | return base_iterator(out, it); | 1755 | 17.9k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::write_int<char, fmt::v11::basic_appender<char>, unsigned int>(fmt::v11::basic_appender<char>, fmt::v11::detail::write_int_arg<unsigned int>, fmt::v11::format_specs const&)::{lambda(fmt::v11::basic_appender<char>)#1}&>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, unsigned long, fmt::v11::detail::write_int<char, fmt::v11::basic_appender<char>, unsigned int>(fmt::v11::basic_appender<char>, fmt::v11::detail::write_int_arg<unsigned int>, fmt::v11::format_specs const&)::{lambda(fmt::v11::basic_appender<char>)#1}&) Line | Count | Source | 1739 | 8.98k | size_t size, size_t width, F&& f) -> OutputIt { | 1740 | 8.98k | static_assert(default_align == align::left || default_align == align::right, | 1741 | 8.98k | ""); | 1742 | 8.98k | unsigned spec_width = to_unsigned(specs.width); | 1743 | 8.98k | size_t padding = spec_width > width ? spec_width - width : 0; | 1744 | | // Shifts are encoded as string literals because static constexpr is not | 1745 | | // supported in constexpr functions. | 1746 | 8.98k | auto* shifts = | 1747 | 8.98k | default_align == align::left ? "\x1f\x1f\x00\x01" : "\x00\x1f\x00\x01"; | 1748 | 8.98k | size_t left_padding = padding >> shifts[static_cast<int>(specs.align())]; | 1749 | 8.98k | size_t right_padding = padding - left_padding; | 1750 | 8.98k | auto it = reserve(out, size + padding * specs.fill_size()); | 1751 | 8.98k | if (left_padding != 0) it = fill<Char>(it, left_padding, specs); | 1752 | 8.98k | it = f(it); | 1753 | 8.98k | if (right_padding != 0) it = fill<Char>(it, right_padding, specs); | 1754 | 8.98k | return base_iterator(out, it); | 1755 | 8.98k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)1, fmt::v11::basic_appender<char>, fmt::v11::detail::write_bytes<char, (fmt::v11::align)1, fmt::v11::basic_appender<char> >(fmt::v11::basic_appender<char>, fmt::v11::basic_string_view<char>, fmt::v11::format_specs const&)::{lambda(fmt::v11::basic_appender<char>)#1}&>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, unsigned long, fmt::v11::detail::write_bytes<char, (fmt::v11::align)1, fmt::v11::basic_appender<char> >(fmt::v11::basic_appender<char>, fmt::v11::basic_string_view<char>, fmt::v11::format_specs const&)::{lambda(fmt::v11::basic_appender<char>)#1}&) Line | Count | Source | 1739 | 6.26k | size_t size, size_t width, F&& f) -> OutputIt { | 1740 | 6.26k | static_assert(default_align == align::left || default_align == align::right, | 1741 | 6.26k | ""); | 1742 | 6.26k | unsigned spec_width = to_unsigned(specs.width); | 1743 | 6.26k | size_t padding = spec_width > width ? spec_width - width : 0; | 1744 | | // Shifts are encoded as string literals because static constexpr is not | 1745 | | // supported in constexpr functions. | 1746 | 6.26k | auto* shifts = | 1747 | 6.26k | default_align == align::left ? "\x1f\x1f\x00\x01" : "\x00\x1f\x00\x01"; | 1748 | 6.26k | size_t left_padding = padding >> shifts[static_cast<int>(specs.align())]; | 1749 | 6.26k | size_t right_padding = padding - left_padding; | 1750 | 6.26k | auto it = reserve(out, size + padding * specs.fill_size()); | 1751 | 6.26k | if (left_padding != 0) it = fill<Char>(it, left_padding, specs); | 1752 | 6.26k | it = f(it); | 1753 | 6.26k | if (right_padding != 0) it = fill<Char>(it, right_padding, specs); | 1754 | 6.26k | return base_iterator(out, it); | 1755 | 6.26k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)1, fmt::v11::basic_appender<char>, fmt::v11::detail::write_nonfinite<char, fmt::v11::basic_appender<char> >(fmt::v11::basic_appender<char>, bool, fmt::v11::format_specs, fmt::v11::sign)::{lambda(fmt::v11::basic_appender<char>)#1}&>(fmt::v11::detail::write_nonfinite<char, fmt::v11::basic_appender<char> >(fmt::v11::basic_appender<char>, bool, fmt::v11::format_specs, fmt::v11::sign)::{lambda(fmt::v11::basic_appender<char>)#1}&, fmt::v11::format_specs const&, unsigned long, unsigned long, fmt::v11::detail::write_nonfinite<char, fmt::v11::basic_appender<char> >(fmt::v11::basic_appender<char>, bool, fmt::v11::format_specs, fmt::v11::sign)::{lambda(fmt::v11::basic_appender<char>)#1}&) Line | Count | Source | 1739 | 33.4k | size_t size, size_t width, F&& f) -> OutputIt { | 1740 | 33.4k | static_assert(default_align == align::left || default_align == align::right, | 1741 | 33.4k | ""); | 1742 | 33.4k | unsigned spec_width = to_unsigned(specs.width); | 1743 | 33.4k | size_t padding = spec_width > width ? spec_width - width : 0; | 1744 | | // Shifts are encoded as string literals because static constexpr is not | 1745 | | // supported in constexpr functions. | 1746 | 33.4k | auto* shifts = | 1747 | 33.4k | default_align == align::left ? "\x1f\x1f\x00\x01" : "\x00\x1f\x00\x01"; | 1748 | 33.4k | size_t left_padding = padding >> shifts[static_cast<int>(specs.align())]; | 1749 | 33.4k | size_t right_padding = padding - left_padding; | 1750 | 33.4k | auto it = reserve(out, size + padding * specs.fill_size()); | 1751 | 33.4k | if (left_padding != 0) it = fill<Char>(it, left_padding, specs); | 1752 | 33.4k | it = f(it); | 1753 | 33.4k | if (right_padding != 0) it = fill<Char>(it, right_padding, specs); | 1754 | 33.4k | return base_iterator(out, it); | 1755 | 33.4k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#1}&>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#1}&) Line | Count | Source | 1739 | 3.05k | size_t size, size_t width, F&& f) -> OutputIt { | 1740 | 3.05k | static_assert(default_align == align::left || default_align == align::right, | 1741 | 3.05k | ""); | 1742 | 3.05k | unsigned spec_width = to_unsigned(specs.width); | 1743 | 3.05k | size_t padding = spec_width > width ? spec_width - width : 0; | 1744 | | // Shifts are encoded as string literals because static constexpr is not | 1745 | | // supported in constexpr functions. | 1746 | 3.05k | auto* shifts = | 1747 | 3.05k | default_align == align::left ? "\x1f\x1f\x00\x01" : "\x00\x1f\x00\x01"; | 1748 | 3.05k | size_t left_padding = padding >> shifts[static_cast<int>(specs.align())]; | 1749 | 3.05k | size_t right_padding = padding - left_padding; | 1750 | 3.05k | auto it = reserve(out, size + padding * specs.fill_size()); | 1751 | 3.05k | if (left_padding != 0) it = fill<Char>(it, left_padding, specs); | 1752 | 3.05k | it = f(it); | 1753 | 3.05k | if (right_padding != 0) it = fill<Char>(it, right_padding, specs); | 1754 | 3.05k | return base_iterator(out, it); | 1755 | 3.05k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#2}&>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#2}&) Line | Count | Source | 1739 | 8.65k | size_t size, size_t width, F&& f) -> OutputIt { | 1740 | 8.65k | static_assert(default_align == align::left || default_align == align::right, | 1741 | 8.65k | ""); | 1742 | 8.65k | unsigned spec_width = to_unsigned(specs.width); | 1743 | 8.65k | size_t padding = spec_width > width ? spec_width - width : 0; | 1744 | | // Shifts are encoded as string literals because static constexpr is not | 1745 | | // supported in constexpr functions. | 1746 | 8.65k | auto* shifts = | 1747 | 8.65k | default_align == align::left ? "\x1f\x1f\x00\x01" : "\x00\x1f\x00\x01"; | 1748 | 8.65k | size_t left_padding = padding >> shifts[static_cast<int>(specs.align())]; | 1749 | 8.65k | size_t right_padding = padding - left_padding; | 1750 | 8.65k | auto it = reserve(out, size + padding * specs.fill_size()); | 1751 | 8.65k | if (left_padding != 0) it = fill<Char>(it, left_padding, specs); | 1752 | 8.65k | it = f(it); | 1753 | 8.65k | if (right_padding != 0) it = fill<Char>(it, right_padding, specs); | 1754 | 8.65k | return base_iterator(out, it); | 1755 | 8.65k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#3}&>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#3}&) Line | Count | Source | 1739 | 5.99k | size_t size, size_t width, F&& f) -> OutputIt { | 1740 | 5.99k | static_assert(default_align == align::left || default_align == align::right, | 1741 | 5.99k | ""); | 1742 | 5.99k | unsigned spec_width = to_unsigned(specs.width); | 1743 | 5.99k | size_t padding = spec_width > width ? spec_width - width : 0; | 1744 | | // Shifts are encoded as string literals because static constexpr is not | 1745 | | // supported in constexpr functions. | 1746 | 5.99k | auto* shifts = | 1747 | 5.99k | default_align == align::left ? "\x1f\x1f\x00\x01" : "\x00\x1f\x00\x01"; | 1748 | 5.99k | size_t left_padding = padding >> shifts[static_cast<int>(specs.align())]; | 1749 | 5.99k | size_t right_padding = padding - left_padding; | 1750 | 5.99k | auto it = reserve(out, size + padding * specs.fill_size()); | 1751 | 5.99k | if (left_padding != 0) it = fill<Char>(it, left_padding, specs); | 1752 | 5.99k | it = f(it); | 1753 | 5.99k | if (right_padding != 0) it = fill<Char>(it, right_padding, specs); | 1754 | 5.99k | return base_iterator(out, it); | 1755 | 5.99k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#4}&>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#4}&) Line | Count | Source | 1739 | 5.06k | size_t size, size_t width, F&& f) -> OutputIt { | 1740 | 5.06k | static_assert(default_align == align::left || default_align == align::right, | 1741 | 5.06k | ""); | 1742 | 5.06k | unsigned spec_width = to_unsigned(specs.width); | 1743 | 5.06k | size_t padding = spec_width > width ? spec_width - width : 0; | 1744 | | // Shifts are encoded as string literals because static constexpr is not | 1745 | | // supported in constexpr functions. | 1746 | 5.06k | auto* shifts = | 1747 | 5.06k | default_align == align::left ? "\x1f\x1f\x00\x01" : "\x00\x1f\x00\x01"; | 1748 | 5.06k | size_t left_padding = padding >> shifts[static_cast<int>(specs.align())]; | 1749 | 5.06k | size_t right_padding = padding - left_padding; | 1750 | 5.06k | auto it = reserve(out, size + padding * specs.fill_size()); | 1751 | 5.06k | if (left_padding != 0) it = fill<Char>(it, left_padding, specs); | 1752 | 5.06k | it = f(it); | 1753 | 5.06k | if (right_padding != 0) it = fill<Char>(it, right_padding, specs); | 1754 | 5.06k | return base_iterator(out, it); | 1755 | 5.06k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#1}&>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#1}&) Line | Count | Source | 1739 | 3.55k | size_t size, size_t width, F&& f) -> OutputIt { | 1740 | 3.55k | static_assert(default_align == align::left || default_align == align::right, | 1741 | 3.55k | ""); | 1742 | 3.55k | unsigned spec_width = to_unsigned(specs.width); | 1743 | 3.55k | size_t padding = spec_width > width ? spec_width - width : 0; | 1744 | | // Shifts are encoded as string literals because static constexpr is not | 1745 | | // supported in constexpr functions. | 1746 | 3.55k | auto* shifts = | 1747 | 3.55k | default_align == align::left ? "\x1f\x1f\x00\x01" : "\x00\x1f\x00\x01"; | 1748 | 3.55k | size_t left_padding = padding >> shifts[static_cast<int>(specs.align())]; | 1749 | 3.55k | size_t right_padding = padding - left_padding; | 1750 | 3.55k | auto it = reserve(out, size + padding * specs.fill_size()); | 1751 | 3.55k | if (left_padding != 0) it = fill<Char>(it, left_padding, specs); | 1752 | 3.55k | it = f(it); | 1753 | 3.55k | if (right_padding != 0) it = fill<Char>(it, right_padding, specs); | 1754 | 3.55k | return base_iterator(out, it); | 1755 | 3.55k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#2}&>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#2}&) Line | Count | Source | 1739 | 8.13k | size_t size, size_t width, F&& f) -> OutputIt { | 1740 | 8.13k | static_assert(default_align == align::left || default_align == align::right, | 1741 | 8.13k | ""); | 1742 | 8.13k | unsigned spec_width = to_unsigned(specs.width); | 1743 | 8.13k | size_t padding = spec_width > width ? spec_width - width : 0; | 1744 | | // Shifts are encoded as string literals because static constexpr is not | 1745 | | // supported in constexpr functions. | 1746 | 8.13k | auto* shifts = | 1747 | 8.13k | default_align == align::left ? "\x1f\x1f\x00\x01" : "\x00\x1f\x00\x01"; | 1748 | 8.13k | size_t left_padding = padding >> shifts[static_cast<int>(specs.align())]; | 1749 | 8.13k | size_t right_padding = padding - left_padding; | 1750 | 8.13k | auto it = reserve(out, size + padding * specs.fill_size()); | 1751 | 8.13k | if (left_padding != 0) it = fill<Char>(it, left_padding, specs); | 1752 | 8.13k | it = f(it); | 1753 | 8.13k | if (right_padding != 0) it = fill<Char>(it, right_padding, specs); | 1754 | 8.13k | return base_iterator(out, it); | 1755 | 8.13k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#3}&>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#3}&) Line | Count | Source | 1739 | 5.63k | size_t size, size_t width, F&& f) -> OutputIt { | 1740 | 5.63k | static_assert(default_align == align::left || default_align == align::right, | 1741 | 5.63k | ""); | 1742 | 5.63k | unsigned spec_width = to_unsigned(specs.width); | 1743 | 5.63k | size_t padding = spec_width > width ? spec_width - width : 0; | 1744 | | // Shifts are encoded as string literals because static constexpr is not | 1745 | | // supported in constexpr functions. | 1746 | 5.63k | auto* shifts = | 1747 | 5.63k | default_align == align::left ? "\x1f\x1f\x00\x01" : "\x00\x1f\x00\x01"; | 1748 | 5.63k | size_t left_padding = padding >> shifts[static_cast<int>(specs.align())]; | 1749 | 5.63k | size_t right_padding = padding - left_padding; | 1750 | 5.63k | auto it = reserve(out, size + padding * specs.fill_size()); | 1751 | 5.63k | if (left_padding != 0) it = fill<Char>(it, left_padding, specs); | 1752 | 5.63k | it = f(it); | 1753 | 5.63k | if (right_padding != 0) it = fill<Char>(it, right_padding, specs); | 1754 | 5.63k | return base_iterator(out, it); | 1755 | 5.63k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#4}&>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#4}&) Line | Count | Source | 1739 | 5.16k | size_t size, size_t width, F&& f) -> OutputIt { | 1740 | 5.16k | static_assert(default_align == align::left || default_align == align::right, | 1741 | 5.16k | ""); | 1742 | 5.16k | unsigned spec_width = to_unsigned(specs.width); | 1743 | 5.16k | size_t padding = spec_width > width ? spec_width - width : 0; | 1744 | | // Shifts are encoded as string literals because static constexpr is not | 1745 | | // supported in constexpr functions. | 1746 | 5.16k | auto* shifts = | 1747 | 5.16k | default_align == align::left ? "\x1f\x1f\x00\x01" : "\x00\x1f\x00\x01"; | 1748 | 5.16k | size_t left_padding = padding >> shifts[static_cast<int>(specs.align())]; | 1749 | 5.16k | size_t right_padding = padding - left_padding; | 1750 | 5.16k | auto it = reserve(out, size + padding * specs.fill_size()); | 1751 | 5.16k | if (left_padding != 0) it = fill<Char>(it, left_padding, specs); | 1752 | 5.16k | it = f(it); | 1753 | 5.16k | if (right_padding != 0) it = fill<Char>(it, right_padding, specs); | 1754 | 5.16k | return base_iterator(out, it); | 1755 | 5.16k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::write_bytes<char, (fmt::v11::align)2, fmt::v11::basic_appender<char> >(fmt::v11::basic_appender<char>, fmt::v11::basic_string_view<char>, fmt::v11::format_specs const&)::{lambda(fmt::v11::basic_appender<char>)#1}&>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, unsigned long, fmt::v11::detail::write_bytes<char, (fmt::v11::align)2, fmt::v11::basic_appender<char> >(fmt::v11::basic_appender<char>, fmt::v11::basic_string_view<char>, fmt::v11::format_specs const&)::{lambda(fmt::v11::basic_appender<char>)#1}&) Line | Count | Source | 1739 | 13.5k | size_t size, size_t width, F&& f) -> OutputIt { | 1740 | 13.5k | static_assert(default_align == align::left || default_align == align::right, | 1741 | 13.5k | ""); | 1742 | 13.5k | unsigned spec_width = to_unsigned(specs.width); | 1743 | 13.5k | size_t padding = spec_width > width ? spec_width - width : 0; | 1744 | | // Shifts are encoded as string literals because static constexpr is not | 1745 | | // supported in constexpr functions. | 1746 | 13.5k | auto* shifts = | 1747 | 13.5k | default_align == align::left ? "\x1f\x1f\x00\x01" : "\x00\x1f\x00\x01"; | 1748 | 13.5k | size_t left_padding = padding >> shifts[static_cast<int>(specs.align())]; | 1749 | 13.5k | size_t right_padding = padding - left_padding; | 1750 | 13.5k | auto it = reserve(out, size + padding * specs.fill_size()); | 1751 | 13.5k | if (left_padding != 0) it = fill<Char>(it, left_padding, specs); | 1752 | 13.5k | it = f(it); | 1753 | 13.5k | if (right_padding != 0) it = fill<Char>(it, right_padding, specs); | 1754 | 13.5k | return base_iterator(out, it); | 1755 | 13.5k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#1}&>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#1}&) Line | Count | Source | 1739 | 4.20k | size_t size, size_t width, F&& f) -> OutputIt { | 1740 | 4.20k | static_assert(default_align == align::left || default_align == align::right, | 1741 | 4.20k | ""); | 1742 | 4.20k | unsigned spec_width = to_unsigned(specs.width); | 1743 | 4.20k | size_t padding = spec_width > width ? spec_width - width : 0; | 1744 | | // Shifts are encoded as string literals because static constexpr is not | 1745 | | // supported in constexpr functions. | 1746 | 4.20k | auto* shifts = | 1747 | 4.20k | default_align == align::left ? "\x1f\x1f\x00\x01" : "\x00\x1f\x00\x01"; | 1748 | 4.20k | size_t left_padding = padding >> shifts[static_cast<int>(specs.align())]; | 1749 | 4.20k | size_t right_padding = padding - left_padding; | 1750 | 4.20k | auto it = reserve(out, size + padding * specs.fill_size()); | 1751 | 4.20k | if (left_padding != 0) it = fill<Char>(it, left_padding, specs); | 1752 | 4.20k | it = f(it); | 1753 | 4.20k | if (right_padding != 0) it = fill<Char>(it, right_padding, specs); | 1754 | 4.20k | return base_iterator(out, it); | 1755 | 4.20k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#2}&>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#2}&) Line | Count | Source | 1739 | 37.7k | size_t size, size_t width, F&& f) -> OutputIt { | 1740 | 37.7k | static_assert(default_align == align::left || default_align == align::right, | 1741 | 37.7k | ""); | 1742 | 37.7k | unsigned spec_width = to_unsigned(specs.width); | 1743 | 37.7k | size_t padding = spec_width > width ? spec_width - width : 0; | 1744 | | // Shifts are encoded as string literals because static constexpr is not | 1745 | | // supported in constexpr functions. | 1746 | 37.7k | auto* shifts = | 1747 | 37.7k | default_align == align::left ? "\x1f\x1f\x00\x01" : "\x00\x1f\x00\x01"; | 1748 | 37.7k | size_t left_padding = padding >> shifts[static_cast<int>(specs.align())]; | 1749 | 37.7k | size_t right_padding = padding - left_padding; | 1750 | 37.7k | auto it = reserve(out, size + padding * specs.fill_size()); | 1751 | 37.7k | if (left_padding != 0) it = fill<Char>(it, left_padding, specs); | 1752 | 37.7k | it = f(it); | 1753 | 37.7k | if (right_padding != 0) it = fill<Char>(it, right_padding, specs); | 1754 | 37.7k | return base_iterator(out, it); | 1755 | 37.7k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#3}&>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#3}&) Line | Count | Source | 1739 | 43.7k | size_t size, size_t width, F&& f) -> OutputIt { | 1740 | 43.7k | static_assert(default_align == align::left || default_align == align::right, | 1741 | 43.7k | ""); | 1742 | 43.7k | unsigned spec_width = to_unsigned(specs.width); | 1743 | 43.7k | size_t padding = spec_width > width ? spec_width - width : 0; | 1744 | | // Shifts are encoded as string literals because static constexpr is not | 1745 | | // supported in constexpr functions. | 1746 | 43.7k | auto* shifts = | 1747 | 43.7k | default_align == align::left ? "\x1f\x1f\x00\x01" : "\x00\x1f\x00\x01"; | 1748 | 43.7k | size_t left_padding = padding >> shifts[static_cast<int>(specs.align())]; | 1749 | 43.7k | size_t right_padding = padding - left_padding; | 1750 | 43.7k | auto it = reserve(out, size + padding * specs.fill_size()); | 1751 | 43.7k | if (left_padding != 0) it = fill<Char>(it, left_padding, specs); | 1752 | 43.7k | it = f(it); | 1753 | 43.7k | if (right_padding != 0) it = fill<Char>(it, right_padding, specs); | 1754 | 43.7k | return base_iterator(out, it); | 1755 | 43.7k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#4}&>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#4}&) Line | Count | Source | 1739 | 127k | size_t size, size_t width, F&& f) -> OutputIt { | 1740 | 127k | static_assert(default_align == align::left || default_align == align::right, | 1741 | 127k | ""); | 1742 | 127k | unsigned spec_width = to_unsigned(specs.width); | 1743 | 127k | size_t padding = spec_width > width ? spec_width - width : 0; | 1744 | | // Shifts are encoded as string literals because static constexpr is not | 1745 | | // supported in constexpr functions. | 1746 | 127k | auto* shifts = | 1747 | 127k | default_align == align::left ? "\x1f\x1f\x00\x01" : "\x00\x1f\x00\x01"; | 1748 | 127k | size_t left_padding = padding >> shifts[static_cast<int>(specs.align())]; | 1749 | 127k | size_t right_padding = padding - left_padding; | 1750 | 127k | auto it = reserve(out, size + padding * specs.fill_size()); | 1751 | 127k | if (left_padding != 0) it = fill<Char>(it, left_padding, specs); | 1752 | 127k | it = f(it); | 1753 | 127k | if (right_padding != 0) it = fill<Char>(it, right_padding, specs); | 1754 | 127k | return base_iterator(out, it); | 1755 | 127k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::write_ptr<char, fmt::v11::basic_appender<char>, unsigned long>(fmt::v11::basic_appender<char>, unsigned long, fmt::v11::format_specs const*)::{lambda(fmt::v11::basic_appender<char>)#1}&>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, unsigned long, fmt::v11::detail::write_ptr<char, fmt::v11::basic_appender<char>, unsigned long>(fmt::v11::basic_appender<char>, unsigned long, fmt::v11::format_specs const*)::{lambda(fmt::v11::basic_appender<char>)#1}&) Line | Count | Source | 1739 | 2.17k | size_t size, size_t width, F&& f) -> OutputIt { | 1740 | 2.17k | static_assert(default_align == align::left || default_align == align::right, | 1741 | 2.17k | ""); | 1742 | 2.17k | unsigned spec_width = to_unsigned(specs.width); | 1743 | 2.17k | size_t padding = spec_width > width ? spec_width - width : 0; | 1744 | | // Shifts are encoded as string literals because static constexpr is not | 1745 | | // supported in constexpr functions. | 1746 | 2.17k | auto* shifts = | 1747 | 2.17k | default_align == align::left ? "\x1f\x1f\x00\x01" : "\x00\x1f\x00\x01"; | 1748 | 2.17k | size_t left_padding = padding >> shifts[static_cast<int>(specs.align())]; | 1749 | 2.17k | size_t right_padding = padding - left_padding; | 1750 | 2.17k | auto it = reserve(out, size + padding * specs.fill_size()); | 1751 | 2.17k | if (left_padding != 0) it = fill<Char>(it, left_padding, specs); | 1752 | 2.17k | it = f(it); | 1753 | 2.17k | if (right_padding != 0) it = fill<Char>(it, right_padding, specs); | 1754 | 2.17k | return base_iterator(out, it); | 1755 | 2.17k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::write_int<char, fmt::v11::basic_appender<char>, unsigned long>(fmt::v11::basic_appender<char>, fmt::v11::detail::write_int_arg<unsigned long>, fmt::v11::format_specs const&)::{lambda(fmt::v11::basic_appender<char>)#1}&>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, unsigned long, fmt::v11::detail::write_int<char, fmt::v11::basic_appender<char>, unsigned long>(fmt::v11::basic_appender<char>, fmt::v11::detail::write_int_arg<unsigned long>, fmt::v11::format_specs const&)::{lambda(fmt::v11::basic_appender<char>)#1}&) Line | Count | Source | 1739 | 7.74k | size_t size, size_t width, F&& f) -> OutputIt { | 1740 | 7.74k | static_assert(default_align == align::left || default_align == align::right, | 1741 | 7.74k | ""); | 1742 | 7.74k | unsigned spec_width = to_unsigned(specs.width); | 1743 | 7.74k | size_t padding = spec_width > width ? spec_width - width : 0; | 1744 | | // Shifts are encoded as string literals because static constexpr is not | 1745 | | // supported in constexpr functions. | 1746 | 7.74k | auto* shifts = | 1747 | 7.74k | default_align == align::left ? "\x1f\x1f\x00\x01" : "\x00\x1f\x00\x01"; | 1748 | 7.74k | size_t left_padding = padding >> shifts[static_cast<int>(specs.align())]; | 1749 | 7.74k | size_t right_padding = padding - left_padding; | 1750 | 7.74k | auto it = reserve(out, size + padding * specs.fill_size()); | 1751 | 7.74k | if (left_padding != 0) it = fill<Char>(it, left_padding, specs); | 1752 | 7.74k | it = f(it); | 1753 | 7.74k | if (right_padding != 0) it = fill<Char>(it, right_padding, specs); | 1754 | 7.74k | return base_iterator(out, it); | 1755 | 7.74k | } |
Unexecuted instantiation: fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::write_int<char, fmt::v11::basic_appender<char>, unsigned __int128>(fmt::v11::basic_appender<char>, fmt::v11::detail::write_int_arg<unsigned __int128>, fmt::v11::format_specs const&)::{lambda(fmt::v11::basic_appender<char>)#1}&>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, unsigned long, fmt::v11::detail::write_int<char, fmt::v11::basic_appender<char>, unsigned __int128>(fmt::v11::basic_appender<char>, fmt::v11::detail::write_int_arg<unsigned __int128>, fmt::v11::format_specs const&)::{lambda(fmt::v11::basic_appender<char>)#1}&) fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)1, fmt::v11::basic_appender<char>, fmt::v11::detail::write<char, fmt::v11::basic_appender<char> >(fmt::v11::basic_appender<char>, fmt::v11::basic_string_view<char>, fmt::v11::format_specs const&)::{lambda(fmt::v11::basic_appender<char>)#1}>(fmt::v11::detail::write<char, fmt::v11::basic_appender<char> >(fmt::v11::basic_appender<char>, fmt::v11::basic_string_view<char>, fmt::v11::format_specs const&)::{lambda(fmt::v11::basic_appender<char>)#1}, fmt::v11::format_specs const&, unsigned long, unsigned long, fmt::v11::detail::write<char, fmt::v11::basic_appender<char> >(fmt::v11::basic_appender<char>, fmt::v11::basic_string_view<char>, fmt::v11::format_specs const&)::{lambda(fmt::v11::basic_appender<char>)#1}&&) Line | Count | Source | 1739 | 319k | size_t size, size_t width, F&& f) -> OutputIt { | 1740 | 319k | static_assert(default_align == align::left || default_align == align::right, | 1741 | 319k | ""); | 1742 | 319k | unsigned spec_width = to_unsigned(specs.width); | 1743 | 319k | size_t padding = spec_width > width ? spec_width - width : 0; | 1744 | | // Shifts are encoded as string literals because static constexpr is not | 1745 | | // supported in constexpr functions. | 1746 | 319k | auto* shifts = | 1747 | 319k | default_align == align::left ? "\x1f\x1f\x00\x01" : "\x00\x1f\x00\x01"; | 1748 | 319k | size_t left_padding = padding >> shifts[static_cast<int>(specs.align())]; | 1749 | 319k | size_t right_padding = padding - left_padding; | 1750 | 319k | auto it = reserve(out, size + padding * specs.fill_size()); | 1751 | 319k | if (left_padding != 0) it = fill<Char>(it, left_padding, specs); | 1752 | 319k | it = f(it); | 1753 | 319k | if (right_padding != 0) it = fill<Char>(it, right_padding, specs); | 1754 | 319k | return base_iterator(out, it); | 1755 | 319k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::write_int<fmt::v11::basic_appender<char>, unsigned long, char>(fmt::v11::basic_appender<char>, unsigned long, unsigned int, fmt::v11::format_specs const&, fmt::v11::detail::digit_grouping<char> const&)::{lambda(fmt::v11::basic_appender<char>)#1}>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, unsigned long, fmt::v11::detail::write_int<fmt::v11::basic_appender<char>, unsigned long, char>(fmt::v11::basic_appender<char>, unsigned long, unsigned int, fmt::v11::format_specs const&, fmt::v11::detail::digit_grouping<char> const&)::{lambda(fmt::v11::basic_appender<char>)#1}&&) Line | Count | Source | 1739 | 14.3k | size_t size, size_t width, F&& f) -> OutputIt { | 1740 | 14.3k | static_assert(default_align == align::left || default_align == align::right, | 1741 | 14.3k | ""); | 1742 | 14.3k | unsigned spec_width = to_unsigned(specs.width); | 1743 | 14.3k | size_t padding = spec_width > width ? spec_width - width : 0; | 1744 | | // Shifts are encoded as string literals because static constexpr is not | 1745 | | // supported in constexpr functions. | 1746 | 14.3k | auto* shifts = | 1747 | 14.3k | default_align == align::left ? "\x1f\x1f\x00\x01" : "\x00\x1f\x00\x01"; | 1748 | 14.3k | size_t left_padding = padding >> shifts[static_cast<int>(specs.align())]; | 1749 | 14.3k | size_t right_padding = padding - left_padding; | 1750 | 14.3k | auto it = reserve(out, size + padding * specs.fill_size()); | 1751 | 14.3k | if (left_padding != 0) it = fill<Char>(it, left_padding, specs); | 1752 | 14.3k | it = f(it); | 1753 | 14.3k | if (right_padding != 0) it = fill<Char>(it, right_padding, specs); | 1754 | 14.3k | return base_iterator(out, it); | 1755 | 14.3k | } |
Unexecuted instantiation: fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::write_int<fmt::v11::basic_appender<char>, unsigned __int128, char>(fmt::v11::basic_appender<char>, unsigned __int128, unsigned int, fmt::v11::format_specs const&, fmt::v11::detail::digit_grouping<char> const&)::{lambda(fmt::v11::basic_appender<char>)#1}>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, unsigned long, fmt::v11::detail::write_int<fmt::v11::basic_appender<char>, unsigned __int128, char>(fmt::v11::basic_appender<char>, unsigned __int128, unsigned int, fmt::v11::format_specs const&, fmt::v11::detail::digit_grouping<char> const&)::{lambda(fmt::v11::basic_appender<char>)#1}&&) Unexecuted instantiation: fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#1}&>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#1}&) Unexecuted instantiation: fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#2}&>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#2}&) Unexecuted instantiation: fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#3}&>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#3}&) Unexecuted instantiation: fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#4}&>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#4}&) Unexecuted instantiation: fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float>, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#1}&>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float>, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#1}&) Unexecuted instantiation: fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float>, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#2}&>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float>, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#2}&) Unexecuted instantiation: fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float>, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#3}&>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float>, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#3}&) Unexecuted instantiation: fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float>, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#4}&>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float>, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#4}&) Unexecuted instantiation: fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double>, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#1}&>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double>, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#1}&) Unexecuted instantiation: fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double>, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#2}&>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double>, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#2}&) Unexecuted instantiation: fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double>, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#3}&>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double>, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#3}&) Unexecuted instantiation: fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double>, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#4}&>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double>, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#4}&) |
1756 | | |
1757 | | template <typename Char, align default_align = align::left, typename OutputIt, |
1758 | | typename F> |
1759 | | constexpr auto write_padded(OutputIt out, const format_specs& specs, |
1760 | 348k | size_t size, F&& f) -> OutputIt { |
1761 | 348k | return write_padded<Char, default_align>(out, specs, size, size, f); |
1762 | 348k | } fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)1, fmt::v11::basic_appender<char>, fmt::v11::detail::write_char<char, fmt::v11::basic_appender<char> >(fmt::v11::basic_appender<char>, char, fmt::v11::format_specs const&)::{lambda(fmt::v11::basic_appender<char>)#1}>(fmt::v11::detail::write_char<char, fmt::v11::basic_appender<char> >(fmt::v11::basic_appender<char>, char, fmt::v11::format_specs const&)::{lambda(fmt::v11::basic_appender<char>)#1}, fmt::v11::format_specs const&, unsigned long, fmt::v11::detail::write_char<char, fmt::v11::basic_appender<char> >(fmt::v11::basic_appender<char>, char, fmt::v11::format_specs const&)::{lambda(fmt::v11::basic_appender<char>)#1}&&) Line | Count | Source | 1760 | 17.9k | size_t size, F&& f) -> OutputIt { | 1761 | 17.9k | return write_padded<Char, default_align>(out, specs, size, size, f); | 1762 | 17.9k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::write_int<char, fmt::v11::basic_appender<char>, unsigned int>(fmt::v11::basic_appender<char>, fmt::v11::detail::write_int_arg<unsigned int>, fmt::v11::format_specs const&)::{lambda(fmt::v11::basic_appender<char>)#1}>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, fmt::v11::detail::write_int<char, fmt::v11::basic_appender<char>, unsigned int>(fmt::v11::basic_appender<char>, fmt::v11::detail::write_int_arg<unsigned int>, fmt::v11::format_specs const&)::{lambda(fmt::v11::basic_appender<char>)#1}&&) Line | Count | Source | 1760 | 8.98k | size_t size, F&& f) -> OutputIt { | 1761 | 8.98k | return write_padded<Char, default_align>(out, specs, size, size, f); | 1762 | 8.98k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)1, fmt::v11::basic_appender<char>, fmt::v11::detail::write_bytes<char, (fmt::v11::align)1, fmt::v11::basic_appender<char> >(fmt::v11::basic_appender<char>, fmt::v11::basic_string_view<char>, fmt::v11::format_specs const&)::{lambda(fmt::v11::basic_appender<char>)#1}>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, fmt::v11::detail::write_bytes<char, (fmt::v11::align)1, fmt::v11::basic_appender<char> >(fmt::v11::basic_appender<char>, fmt::v11::basic_string_view<char>, fmt::v11::format_specs const&)::{lambda(fmt::v11::basic_appender<char>)#1}&&) Line | Count | Source | 1760 | 6.26k | size_t size, F&& f) -> OutputIt { | 1761 | 6.26k | return write_padded<Char, default_align>(out, specs, size, size, f); | 1762 | 6.26k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)1, fmt::v11::basic_appender<char>, fmt::v11::detail::write_nonfinite<char, fmt::v11::basic_appender<char> >(fmt::v11::basic_appender<char>, bool, fmt::v11::format_specs, fmt::v11::sign)::{lambda(fmt::v11::basic_appender<char>)#1}>(fmt::v11::detail::write_nonfinite<char, fmt::v11::basic_appender<char> >(fmt::v11::basic_appender<char>, bool, fmt::v11::format_specs, fmt::v11::sign)::{lambda(fmt::v11::basic_appender<char>)#1}, fmt::v11::format_specs const&, unsigned long, fmt::v11::detail::write_nonfinite<char, fmt::v11::basic_appender<char> >(fmt::v11::basic_appender<char>, bool, fmt::v11::format_specs, fmt::v11::sign)::{lambda(fmt::v11::basic_appender<char>)#1}&&) Line | Count | Source | 1760 | 33.4k | size_t size, F&& f) -> OutputIt { | 1761 | 33.4k | return write_padded<Char, default_align>(out, specs, size, size, f); | 1762 | 33.4k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#1}&>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#1}&) Line | Count | Source | 1760 | 3.05k | size_t size, F&& f) -> OutputIt { | 1761 | 3.05k | return write_padded<Char, default_align>(out, specs, size, size, f); | 1762 | 3.05k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#2}>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#2}&&) Line | Count | Source | 1760 | 8.65k | size_t size, F&& f) -> OutputIt { | 1761 | 8.65k | return write_padded<Char, default_align>(out, specs, size, size, f); | 1762 | 8.65k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#3}>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#3}&&) Line | Count | Source | 1760 | 5.99k | size_t size, F&& f) -> OutputIt { | 1761 | 5.99k | return write_padded<Char, default_align>(out, specs, size, size, f); | 1762 | 5.99k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#4}>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#4}&&) Line | Count | Source | 1760 | 5.06k | size_t size, F&& f) -> OutputIt { | 1761 | 5.06k | return write_padded<Char, default_align>(out, specs, size, size, f); | 1762 | 5.06k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#1}&>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#1}&) Line | Count | Source | 1760 | 3.55k | size_t size, F&& f) -> OutputIt { | 1761 | 3.55k | return write_padded<Char, default_align>(out, specs, size, size, f); | 1762 | 3.55k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#2}>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#2}&&) Line | Count | Source | 1760 | 8.13k | size_t size, F&& f) -> OutputIt { | 1761 | 8.13k | return write_padded<Char, default_align>(out, specs, size, size, f); | 1762 | 8.13k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#3}>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#3}&&) Line | Count | Source | 1760 | 5.63k | size_t size, F&& f) -> OutputIt { | 1761 | 5.63k | return write_padded<Char, default_align>(out, specs, size, size, f); | 1762 | 5.63k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#4}>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#4}&&) Line | Count | Source | 1760 | 5.16k | size_t size, F&& f) -> OutputIt { | 1761 | 5.16k | return write_padded<Char, default_align>(out, specs, size, size, f); | 1762 | 5.16k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::write_bytes<char, (fmt::v11::align)2, fmt::v11::basic_appender<char> >(fmt::v11::basic_appender<char>, fmt::v11::basic_string_view<char>, fmt::v11::format_specs const&)::{lambda(fmt::v11::basic_appender<char>)#1}>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, fmt::v11::detail::write_bytes<char, (fmt::v11::align)2, fmt::v11::basic_appender<char> >(fmt::v11::basic_appender<char>, fmt::v11::basic_string_view<char>, fmt::v11::format_specs const&)::{lambda(fmt::v11::basic_appender<char>)#1}&&) Line | Count | Source | 1760 | 13.5k | size_t size, F&& f) -> OutputIt { | 1761 | 13.5k | return write_padded<Char, default_align>(out, specs, size, size, f); | 1762 | 13.5k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#1}&>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#1}&) Line | Count | Source | 1760 | 4.20k | size_t size, F&& f) -> OutputIt { | 1761 | 4.20k | return write_padded<Char, default_align>(out, specs, size, size, f); | 1762 | 4.20k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#2}>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#2}&&) Line | Count | Source | 1760 | 37.7k | size_t size, F&& f) -> OutputIt { | 1761 | 37.7k | return write_padded<Char, default_align>(out, specs, size, size, f); | 1762 | 37.7k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#3}>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#3}&&) Line | Count | Source | 1760 | 43.7k | size_t size, F&& f) -> OutputIt { | 1761 | 43.7k | return write_padded<Char, default_align>(out, specs, size, size, f); | 1762 | 43.7k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#4}>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#4}&&) Line | Count | Source | 1760 | 127k | size_t size, F&& f) -> OutputIt { | 1761 | 127k | return write_padded<Char, default_align>(out, specs, size, size, f); | 1762 | 127k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::write_ptr<char, fmt::v11::basic_appender<char>, unsigned long>(fmt::v11::basic_appender<char>, unsigned long, fmt::v11::format_specs const*)::{lambda(fmt::v11::basic_appender<char>)#1}&>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, fmt::v11::detail::write_ptr<char, fmt::v11::basic_appender<char>, unsigned long>(fmt::v11::basic_appender<char>, unsigned long, fmt::v11::format_specs const*)::{lambda(fmt::v11::basic_appender<char>)#1}&) Line | Count | Source | 1760 | 2.17k | size_t size, F&& f) -> OutputIt { | 1761 | 2.17k | return write_padded<Char, default_align>(out, specs, size, size, f); | 1762 | 2.17k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::write_int<char, fmt::v11::basic_appender<char>, unsigned long>(fmt::v11::basic_appender<char>, fmt::v11::detail::write_int_arg<unsigned long>, fmt::v11::format_specs const&)::{lambda(fmt::v11::basic_appender<char>)#1}>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, fmt::v11::detail::write_int<char, fmt::v11::basic_appender<char>, unsigned long>(fmt::v11::basic_appender<char>, fmt::v11::detail::write_int_arg<unsigned long>, fmt::v11::format_specs const&)::{lambda(fmt::v11::basic_appender<char>)#1}&&) Line | Count | Source | 1760 | 7.74k | size_t size, F&& f) -> OutputIt { | 1761 | 7.74k | return write_padded<Char, default_align>(out, specs, size, size, f); | 1762 | 7.74k | } |
Unexecuted instantiation: fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::write_int<char, fmt::v11::basic_appender<char>, unsigned __int128>(fmt::v11::basic_appender<char>, fmt::v11::detail::write_int_arg<unsigned __int128>, fmt::v11::format_specs const&)::{lambda(fmt::v11::basic_appender<char>)#1}>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, fmt::v11::detail::write_int<char, fmt::v11::basic_appender<char>, unsigned __int128>(fmt::v11::basic_appender<char>, fmt::v11::detail::write_int_arg<unsigned __int128>, fmt::v11::format_specs const&)::{lambda(fmt::v11::basic_appender<char>)#1}&&) Unexecuted instantiation: fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#1}&>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#1}&) Unexecuted instantiation: fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#2}>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#2}&&) Unexecuted instantiation: fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#3}>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#3}&&) Unexecuted instantiation: fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#4}>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#4}&&) Unexecuted instantiation: fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float>, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#1}&>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float>, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#1}&) Unexecuted instantiation: fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float>, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#2}>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float>, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#2}&&) Unexecuted instantiation: fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float>, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#3}>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float>, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#3}&&) Unexecuted instantiation: fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float>, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#4}>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float>, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#4}&&) Unexecuted instantiation: fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double>, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#1}&>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double>, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#1}&) Unexecuted instantiation: fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double>, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#2}>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double>, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#2}&&) Unexecuted instantiation: fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double>, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#3}>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double>, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#3}&&) Unexecuted instantiation: fmt::v11::basic_appender<char> fmt::v11::detail::write_padded<char, (fmt::v11::align)2, fmt::v11::basic_appender<char>, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double>, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#4}>(fmt::v11::basic_appender<char>, fmt::v11::format_specs const&, unsigned long, fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double>, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#4}&&) |
1763 | | |
1764 | | template <typename Char, align default_align = align::left, typename OutputIt> |
1765 | | FMT_CONSTEXPR auto write_bytes(OutputIt out, string_view bytes, |
1766 | 19.8k | const format_specs& specs = {}) -> OutputIt { |
1767 | 19.8k | return write_padded<Char, default_align>( |
1768 | 19.8k | out, specs, bytes.size(), [bytes](reserve_iterator<OutputIt> it) { |
1769 | 19.7k | const char* data = bytes.data(); |
1770 | 19.7k | return copy<Char>(data, data + bytes.size(), it); |
1771 | 19.7k | }); fmt::v11::detail::write_bytes<char, (fmt::v11::align)1, fmt::v11::basic_appender<char> >(fmt::v11::basic_appender<char>, fmt::v11::basic_string_view<char>, fmt::v11::format_specs const&)::{lambda(fmt::v11::basic_appender<char>)#1}::operator()(fmt::v11::basic_appender<char>) const Line | Count | Source | 1768 | 6.23k | out, specs, bytes.size(), [bytes](reserve_iterator<OutputIt> it) { | 1769 | 6.23k | const char* data = bytes.data(); | 1770 | 6.23k | return copy<Char>(data, data + bytes.size(), it); | 1771 | 6.23k | }); |
fmt::v11::detail::write_bytes<char, (fmt::v11::align)2, fmt::v11::basic_appender<char> >(fmt::v11::basic_appender<char>, fmt::v11::basic_string_view<char>, fmt::v11::format_specs const&)::{lambda(fmt::v11::basic_appender<char>)#1}::operator()(fmt::v11::basic_appender<char>) const Line | Count | Source | 1768 | 13.4k | out, specs, bytes.size(), [bytes](reserve_iterator<OutputIt> it) { | 1769 | 13.4k | const char* data = bytes.data(); | 1770 | 13.4k | return copy<Char>(data, data + bytes.size(), it); | 1771 | 13.4k | }); |
|
1772 | 19.8k | } fmt::v11::basic_appender<char> fmt::v11::detail::write_bytes<char, (fmt::v11::align)1, fmt::v11::basic_appender<char> >(fmt::v11::basic_appender<char>, fmt::v11::basic_string_view<char>, fmt::v11::format_specs const&) Line | Count | Source | 1766 | 6.26k | const format_specs& specs = {}) -> OutputIt { | 1767 | 6.26k | return write_padded<Char, default_align>( | 1768 | 6.26k | out, specs, bytes.size(), [bytes](reserve_iterator<OutputIt> it) { | 1769 | 6.26k | const char* data = bytes.data(); | 1770 | 6.26k | return copy<Char>(data, data + bytes.size(), it); | 1771 | 6.26k | }); | 1772 | 6.26k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_bytes<char, (fmt::v11::align)2, fmt::v11::basic_appender<char> >(fmt::v11::basic_appender<char>, fmt::v11::basic_string_view<char>, fmt::v11::format_specs const&) Line | Count | Source | 1766 | 13.5k | const format_specs& specs = {}) -> OutputIt { | 1767 | 13.5k | return write_padded<Char, default_align>( | 1768 | 13.5k | out, specs, bytes.size(), [bytes](reserve_iterator<OutputIt> it) { | 1769 | 13.5k | const char* data = bytes.data(); | 1770 | 13.5k | return copy<Char>(data, data + bytes.size(), it); | 1771 | 13.5k | }); | 1772 | 13.5k | } |
|
1773 | | |
1774 | | template <typename Char, typename OutputIt, typename UIntPtr> |
1775 | | auto write_ptr(OutputIt out, UIntPtr value, const format_specs* specs) |
1776 | 2.17k | -> OutputIt { |
1777 | 2.17k | int num_digits = count_digits<4>(value); |
1778 | 2.17k | auto size = to_unsigned(num_digits) + size_t(2); |
1779 | 2.17k | auto write = [=](reserve_iterator<OutputIt> it) { |
1780 | 2.14k | *it++ = static_cast<Char>('0'); |
1781 | 2.14k | *it++ = static_cast<Char>('x'); |
1782 | 2.14k | return format_base2e<Char>(4, it, value, num_digits); |
1783 | 2.14k | }; |
1784 | 2.17k | return specs ? write_padded<Char, align::right>(out, *specs, size, write) |
1785 | 2.17k | : base_iterator(out, write(reserve(out, size))); |
1786 | 2.17k | } |
1787 | | |
1788 | | // Returns true iff the code point cp is printable. |
1789 | | FMT_API auto is_printable(uint32_t cp) -> bool; |
1790 | | |
1791 | 11.7k | inline auto needs_escape(uint32_t cp) -> bool { |
1792 | 11.7k | if (cp < 0x20 || cp == 0x7f || cp == '"' || cp == '\\') return true; |
1793 | 4.67k | if (FMT_OPTIMIZE_SIZE > 1) return false; |
1794 | 4.67k | return !is_printable(cp); |
1795 | 4.67k | } |
1796 | | |
1797 | | template <typename Char> struct find_escape_result { |
1798 | | const Char* begin; |
1799 | | const Char* end; |
1800 | | uint32_t cp; |
1801 | | }; |
1802 | | |
1803 | | template <typename Char> |
1804 | | auto find_escape(const Char* begin, const Char* end) |
1805 | 0 | -> find_escape_result<Char> { |
1806 | 0 | for (; begin != end; ++begin) { |
1807 | 0 | uint32_t cp = static_cast<unsigned_char<Char>>(*begin); |
1808 | 0 | if (const_check(sizeof(Char) == 1) && cp >= 0x80) continue; |
1809 | 0 | if (needs_escape(cp)) return {begin, begin + 1, cp}; |
1810 | 0 | } |
1811 | 0 | return {begin, nullptr, 0}; |
1812 | 0 | } |
1813 | | |
1814 | | inline auto find_escape(const char* begin, const char* end) |
1815 | 0 | -> find_escape_result<char> { |
1816 | 0 | if (!use_utf8) return find_escape<char>(begin, end); |
1817 | 0 | auto result = find_escape_result<char>{end, nullptr, 0}; |
1818 | 0 | for_each_codepoint(string_view(begin, to_unsigned(end - begin)), |
1819 | 0 | [&](uint32_t cp, string_view sv) { |
1820 | 0 | if (needs_escape(cp)) { |
1821 | 0 | result = {sv.begin(), sv.end(), cp}; |
1822 | 0 | return false; |
1823 | 0 | } |
1824 | 0 | return true; |
1825 | 0 | }); |
1826 | 0 | return result; |
1827 | 0 | } |
1828 | | |
1829 | | template <size_t width, typename Char, typename OutputIt> |
1830 | 4.15k | auto write_codepoint(OutputIt out, char prefix, uint32_t cp) -> OutputIt { |
1831 | 4.15k | *out++ = static_cast<Char>('\\'); |
1832 | 4.15k | *out++ = static_cast<Char>(prefix); |
1833 | 4.15k | Char buf[width]; |
1834 | 4.15k | fill_n(buf, width, static_cast<Char>('0')); |
1835 | 4.15k | format_base2e(4, buf, cp, width); |
1836 | 4.15k | return copy<Char>(buf, buf + width, out); |
1837 | 4.15k | } fmt::v11::basic_appender<char> fmt::v11::detail::write_codepoint<2ul, char, fmt::v11::basic_appender<char> >(fmt::v11::basic_appender<char>, char, unsigned int) Line | Count | Source | 1830 | 4.15k | auto write_codepoint(OutputIt out, char prefix, uint32_t cp) -> OutputIt { | 1831 | 4.15k | *out++ = static_cast<Char>('\\'); | 1832 | 4.15k | *out++ = static_cast<Char>(prefix); | 1833 | 4.15k | Char buf[width]; | 1834 | 4.15k | fill_n(buf, width, static_cast<Char>('0')); | 1835 | 4.15k | format_base2e(4, buf, cp, width); | 1836 | 4.15k | return copy<Char>(buf, buf + width, out); | 1837 | 4.15k | } |
Unexecuted instantiation: fmt::v11::basic_appender<char> fmt::v11::detail::write_codepoint<4ul, char, fmt::v11::basic_appender<char> >(fmt::v11::basic_appender<char>, char, unsigned int) Unexecuted instantiation: fmt::v11::basic_appender<char> fmt::v11::detail::write_codepoint<8ul, char, fmt::v11::basic_appender<char> >(fmt::v11::basic_appender<char>, char, unsigned int) |
1838 | | |
1839 | | template <typename OutputIt, typename Char> |
1840 | | auto write_escaped_cp(OutputIt out, const find_escape_result<Char>& escape) |
1841 | 9.66k | -> OutputIt { |
1842 | 9.66k | auto c = static_cast<Char>(escape.cp); |
1843 | 9.66k | switch (escape.cp) { |
1844 | 1.05k | case '\n': |
1845 | 1.05k | *out++ = static_cast<Char>('\\'); |
1846 | 1.05k | c = static_cast<Char>('n'); |
1847 | 1.05k | break; |
1848 | 873 | case '\r': |
1849 | 873 | *out++ = static_cast<Char>('\\'); |
1850 | 873 | c = static_cast<Char>('r'); |
1851 | 873 | break; |
1852 | 1.44k | case '\t': |
1853 | 1.44k | *out++ = static_cast<Char>('\\'); |
1854 | 1.44k | c = static_cast<Char>('t'); |
1855 | 1.44k | break; |
1856 | 0 | case '"': FMT_FALLTHROUGH; |
1857 | 972 | case '\'': FMT_FALLTHROUGH; |
1858 | 2.14k | case '\\': *out++ = static_cast<Char>('\\'); break; |
1859 | 4.15k | default: |
1860 | 4.15k | if (escape.cp < 0x100) return write_codepoint<2, Char>(out, 'x', escape.cp); |
1861 | 2.20k | if (escape.cp < 0x10000) |
1862 | 0 | return write_codepoint<4, Char>(out, 'u', escape.cp); |
1863 | 2.20k | if (escape.cp < 0x110000) |
1864 | 0 | return write_codepoint<8, Char>(out, 'U', escape.cp); |
1865 | 2.20k | for (Char escape_char : basic_string_view<Char>( |
1866 | 2.20k | escape.begin, to_unsigned(escape.end - escape.begin))) { |
1867 | 2.20k | out = write_codepoint<2, Char>(out, 'x', |
1868 | 2.20k | static_cast<uint32_t>(escape_char) & 0xFF); |
1869 | 2.20k | } |
1870 | 2.20k | return out; |
1871 | 9.66k | } |
1872 | 5.51k | *out++ = c; |
1873 | 5.51k | return out; |
1874 | 9.66k | } |
1875 | | |
1876 | | template <typename Char, typename OutputIt> |
1877 | | auto write_escaped_string(OutputIt out, basic_string_view<Char> str) |
1878 | 0 | -> OutputIt { |
1879 | 0 | *out++ = static_cast<Char>('"'); |
1880 | 0 | auto begin = str.begin(), end = str.end(); |
1881 | 0 | do { |
1882 | 0 | auto escape = find_escape(begin, end); |
1883 | 0 | out = copy<Char>(begin, escape.begin, out); |
1884 | 0 | begin = escape.end; |
1885 | 0 | if (!begin) break; |
1886 | 0 | out = write_escaped_cp<OutputIt, Char>(out, escape); |
1887 | 0 | } while (begin != end); |
1888 | 0 | *out++ = static_cast<Char>('"'); |
1889 | 0 | return out; |
1890 | 0 | } |
1891 | | |
1892 | | template <typename Char, typename OutputIt> |
1893 | 11.7k | auto write_escaped_char(OutputIt out, Char v) -> OutputIt { |
1894 | 11.7k | Char v_array[1] = {v}; |
1895 | 11.7k | *out++ = static_cast<Char>('\''); |
1896 | 11.7k | if ((needs_escape(static_cast<uint32_t>(v)) && v != static_cast<Char>('"')) || |
1897 | 11.7k | v == static_cast<Char>('\'')) { |
1898 | 9.66k | out = write_escaped_cp(out, |
1899 | 9.66k | find_escape_result<Char>{v_array, v_array + 1, |
1900 | 9.66k | static_cast<uint32_t>(v)}); |
1901 | 9.66k | } else { |
1902 | 2.12k | *out++ = v; |
1903 | 2.12k | } |
1904 | 11.7k | *out++ = static_cast<Char>('\''); |
1905 | 11.7k | return out; |
1906 | 11.7k | } |
1907 | | |
1908 | | template <typename Char, typename OutputIt> |
1909 | | FMT_CONSTEXPR auto write_char(OutputIt out, Char value, |
1910 | 17.9k | const format_specs& specs) -> OutputIt { |
1911 | 17.9k | bool is_debug = specs.type() == presentation_type::debug; |
1912 | 17.9k | return write_padded<Char>(out, specs, 1, [=](reserve_iterator<OutputIt> it) { |
1913 | 17.8k | if (is_debug) return write_escaped_char(it, value); |
1914 | 6.01k | *it++ = value; |
1915 | 6.01k | return it; |
1916 | 17.8k | }); |
1917 | 17.9k | } |
1918 | | template <typename Char, typename OutputIt> |
1919 | | FMT_CONSTEXPR auto write(OutputIt out, Char value, const format_specs& specs, |
1920 | 19.5k | locale_ref loc = {}) -> OutputIt { |
1921 | | // char is formatted as unsigned char for consistency across platforms. |
1922 | 19.5k | using unsigned_type = |
1923 | 19.5k | conditional_t<std::is_same<Char, char>::value, unsigned char, unsigned>; |
1924 | 19.5k | return check_char_specs(specs) |
1925 | 19.5k | ? write_char<Char>(out, value, specs) |
1926 | 19.5k | : write<Char>(out, static_cast<unsigned_type>(value), specs, loc); |
1927 | 19.5k | } |
1928 | | |
1929 | | template <typename Char> class digit_grouping { |
1930 | | private: |
1931 | | std::string grouping_; |
1932 | | std::basic_string<Char> thousands_sep_; |
1933 | | |
1934 | | struct next_state { |
1935 | | std::string::const_iterator group; |
1936 | | int pos; |
1937 | | }; |
1938 | 138k | auto initial_state() const -> next_state { return {grouping_.begin(), 0}; } |
1939 | | |
1940 | | // Returns the next digit group separator position. |
1941 | 138k | auto next(next_state& state) const -> int { |
1942 | 138k | if (thousands_sep_.empty()) return max_value<int>(); |
1943 | 0 | if (state.group == grouping_.end()) return state.pos += grouping_.back(); |
1944 | 0 | if (*state.group <= 0 || *state.group == max_value<char>()) |
1945 | 0 | return max_value<int>(); |
1946 | 0 | state.pos += *state.group++; |
1947 | 0 | return state.pos; |
1948 | 0 | } |
1949 | | |
1950 | | public: |
1951 | 109k | explicit digit_grouping(locale_ref loc, bool localized = true) { |
1952 | 109k | if (!localized) return; |
1953 | 1.09k | auto sep = thousands_sep<Char>(loc); |
1954 | 1.09k | grouping_ = sep.grouping; |
1955 | 1.09k | if (sep.thousands_sep) thousands_sep_.assign(1, sep.thousands_sep); |
1956 | 1.09k | } |
1957 | | digit_grouping(std::string grouping, std::basic_string<Char> sep) |
1958 | 14.9k | : grouping_(std::move(grouping)), thousands_sep_(std::move(sep)) {} |
1959 | | |
1960 | 109k | auto has_separator() const -> bool { return !thousands_sep_.empty(); } |
1961 | | |
1962 | 124k | auto count_separators(int num_digits) const -> int { |
1963 | 124k | int count = 0; |
1964 | 124k | auto state = initial_state(); |
1965 | 124k | while (num_digits > next(state)) ++count; |
1966 | 124k | return count; |
1967 | 124k | } |
1968 | | |
1969 | | // Applies grouping to digits and write the output to out. |
1970 | | template <typename Out, typename C> |
1971 | 14.2k | auto apply(Out out, basic_string_view<C> digits) const -> Out { |
1972 | 14.2k | auto num_digits = static_cast<int>(digits.size()); |
1973 | 14.2k | auto separators = basic_memory_buffer<int>(); |
1974 | 14.2k | separators.push_back(0); |
1975 | 14.2k | auto state = initial_state(); |
1976 | 14.2k | while (int i = next(state)) { |
1977 | 14.2k | if (i >= num_digits) break; |
1978 | 0 | separators.push_back(i); |
1979 | 0 | } |
1980 | 14.2k | for (int i = 0, sep_index = static_cast<int>(separators.size() - 1); |
1981 | 151k | i < num_digits; ++i) { |
1982 | 137k | if (num_digits - i == separators[sep_index]) { |
1983 | 0 | out = copy<Char>(thousands_sep_.data(), |
1984 | 0 | thousands_sep_.data() + thousands_sep_.size(), out); |
1985 | 0 | --sep_index; |
1986 | 0 | } |
1987 | 137k | *out++ = static_cast<Char>(digits[to_unsigned(i)]); |
1988 | 137k | } |
1989 | 14.2k | return out; |
1990 | 14.2k | } |
1991 | | }; |
1992 | | |
1993 | 18.4k | FMT_CONSTEXPR inline void prefix_append(unsigned& prefix, unsigned value) { |
1994 | 18.4k | prefix |= prefix != 0 ? value << 8 : value; |
1995 | 18.4k | prefix += (1u + (value > 0xff ? 1 : 0)) << 24; |
1996 | 18.4k | } |
1997 | | |
1998 | | // Writes a decimal integer with digit grouping. |
1999 | | template <typename OutputIt, typename UInt, typename Char> |
2000 | | auto write_int(OutputIt out, UInt value, unsigned prefix, |
2001 | | const format_specs& specs, const digit_grouping<Char>& grouping) |
2002 | 14.9k | -> OutputIt { |
2003 | 14.9k | static_assert(std::is_same<uint64_or_128_t<UInt>, UInt>::value, ""); |
2004 | 14.9k | int num_digits = 0; |
2005 | 14.9k | auto buffer = memory_buffer(); |
2006 | 14.9k | switch (specs.type()) { |
2007 | 0 | default: FMT_ASSERT(false, ""); FMT_FALLTHROUGH; |
2008 | 4.97k | case presentation_type::none: |
2009 | 5.58k | case presentation_type::dec: |
2010 | 5.58k | num_digits = count_digits(value); |
2011 | 5.58k | format_decimal<char>(appender(buffer), value, num_digits); |
2012 | 5.58k | break; |
2013 | 3.15k | case presentation_type::hex: |
2014 | 3.15k | if (specs.alt()) |
2015 | 2.18k | prefix_append(prefix, unsigned(specs.upper() ? 'X' : 'x') << 8 | '0'); |
2016 | 3.15k | num_digits = count_digits<4>(value); |
2017 | 3.15k | format_base2e<char>(4, appender(buffer), value, num_digits, specs.upper()); |
2018 | 3.15k | break; |
2019 | 3.08k | case presentation_type::oct: |
2020 | 3.08k | num_digits = count_digits<3>(value); |
2021 | | // Octal prefix '0' is counted as a digit, so only add it if precision |
2022 | | // is not greater than the number of digits. |
2023 | 3.08k | if (specs.alt() && specs.precision <= num_digits && value != 0) |
2024 | 1.53k | prefix_append(prefix, '0'); |
2025 | 3.08k | format_base2e<char>(3, appender(buffer), value, num_digits); |
2026 | 3.08k | break; |
2027 | 2.54k | case presentation_type::bin: |
2028 | 2.54k | if (specs.alt()) |
2029 | 1.64k | prefix_append(prefix, unsigned(specs.upper() ? 'B' : 'b') << 8 | '0'); |
2030 | 2.54k | num_digits = count_digits<1>(value); |
2031 | 2.54k | format_base2e<char>(1, appender(buffer), value, num_digits); |
2032 | 2.54k | break; |
2033 | 546 | case presentation_type::chr: |
2034 | 546 | return write_char<Char>(out, static_cast<Char>(value), specs); |
2035 | 14.9k | } |
2036 | | |
2037 | 14.3k | unsigned size = (prefix != 0 ? prefix >> 24 : 0) + to_unsigned(num_digits) + |
2038 | 14.3k | to_unsigned(grouping.count_separators(num_digits)); |
2039 | 14.3k | return write_padded<Char, align::right>( |
2040 | 14.3k | out, specs, size, size, [&](reserve_iterator<OutputIt> it) { |
2041 | 28.0k | for (unsigned p = prefix & 0xffffff; p != 0; p >>= 8) |
2042 | 13.7k | *it++ = static_cast<Char>(p & 0xff); |
2043 | 14.2k | return grouping.apply(it, string_view(buffer.data(), buffer.size())); |
2044 | 14.2k | }); fmt::v11::detail::write_int<fmt::v11::basic_appender<char>, unsigned long, char>(fmt::v11::basic_appender<char>, unsigned long, unsigned int, fmt::v11::format_specs const&, fmt::v11::detail::digit_grouping<char> const&)::{lambda(fmt::v11::basic_appender<char>)#1}::operator()(fmt::v11::basic_appender<char>) const Line | Count | Source | 2040 | 14.2k | out, specs, size, size, [&](reserve_iterator<OutputIt> it) { | 2041 | 28.0k | for (unsigned p = prefix & 0xffffff; p != 0; p >>= 8) | 2042 | 13.7k | *it++ = static_cast<Char>(p & 0xff); | 2043 | 14.2k | return grouping.apply(it, string_view(buffer.data(), buffer.size())); | 2044 | 14.2k | }); |
Unexecuted instantiation: fmt::v11::detail::write_int<fmt::v11::basic_appender<char>, unsigned __int128, char>(fmt::v11::basic_appender<char>, unsigned __int128, unsigned int, fmt::v11::format_specs const&, fmt::v11::detail::digit_grouping<char> const&)::{lambda(fmt::v11::basic_appender<char>)#1}::operator()(fmt::v11::basic_appender<char>) const |
2045 | 14.9k | } fmt::v11::basic_appender<char> fmt::v11::detail::write_int<fmt::v11::basic_appender<char>, unsigned long, char>(fmt::v11::basic_appender<char>, unsigned long, unsigned int, fmt::v11::format_specs const&, fmt::v11::detail::digit_grouping<char> const&) Line | Count | Source | 2002 | 14.9k | -> OutputIt { | 2003 | 14.9k | static_assert(std::is_same<uint64_or_128_t<UInt>, UInt>::value, ""); | 2004 | 14.9k | int num_digits = 0; | 2005 | 14.9k | auto buffer = memory_buffer(); | 2006 | 14.9k | switch (specs.type()) { | 2007 | 0 | default: FMT_ASSERT(false, ""); FMT_FALLTHROUGH; | 2008 | 4.97k | case presentation_type::none: | 2009 | 5.58k | case presentation_type::dec: | 2010 | 5.58k | num_digits = count_digits(value); | 2011 | 5.58k | format_decimal<char>(appender(buffer), value, num_digits); | 2012 | 5.58k | break; | 2013 | 3.15k | case presentation_type::hex: | 2014 | 3.15k | if (specs.alt()) | 2015 | 2.18k | prefix_append(prefix, unsigned(specs.upper() ? 'X' : 'x') << 8 | '0'); | 2016 | 3.15k | num_digits = count_digits<4>(value); | 2017 | 3.15k | format_base2e<char>(4, appender(buffer), value, num_digits, specs.upper()); | 2018 | 3.15k | break; | 2019 | 3.08k | case presentation_type::oct: | 2020 | 3.08k | num_digits = count_digits<3>(value); | 2021 | | // Octal prefix '0' is counted as a digit, so only add it if precision | 2022 | | // is not greater than the number of digits. | 2023 | 3.08k | if (specs.alt() && specs.precision <= num_digits && value != 0) | 2024 | 1.53k | prefix_append(prefix, '0'); | 2025 | 3.08k | format_base2e<char>(3, appender(buffer), value, num_digits); | 2026 | 3.08k | break; | 2027 | 2.54k | case presentation_type::bin: | 2028 | 2.54k | if (specs.alt()) | 2029 | 1.64k | prefix_append(prefix, unsigned(specs.upper() ? 'B' : 'b') << 8 | '0'); | 2030 | 2.54k | num_digits = count_digits<1>(value); | 2031 | 2.54k | format_base2e<char>(1, appender(buffer), value, num_digits); | 2032 | 2.54k | break; | 2033 | 546 | case presentation_type::chr: | 2034 | 546 | return write_char<Char>(out, static_cast<Char>(value), specs); | 2035 | 14.9k | } | 2036 | | | 2037 | 14.3k | unsigned size = (prefix != 0 ? prefix >> 24 : 0) + to_unsigned(num_digits) + | 2038 | 14.3k | to_unsigned(grouping.count_separators(num_digits)); | 2039 | 14.3k | return write_padded<Char, align::right>( | 2040 | 14.3k | out, specs, size, size, [&](reserve_iterator<OutputIt> it) { | 2041 | 14.3k | for (unsigned p = prefix & 0xffffff; p != 0; p >>= 8) | 2042 | 14.3k | *it++ = static_cast<Char>(p & 0xff); | 2043 | 14.3k | return grouping.apply(it, string_view(buffer.data(), buffer.size())); | 2044 | 14.3k | }); | 2045 | 14.9k | } |
Unexecuted instantiation: fmt::v11::basic_appender<char> fmt::v11::detail::write_int<fmt::v11::basic_appender<char>, unsigned __int128, char>(fmt::v11::basic_appender<char>, unsigned __int128, unsigned int, fmt::v11::format_specs const&, fmt::v11::detail::digit_grouping<char> const&) |
2046 | | |
2047 | | #if FMT_USE_LOCALE |
2048 | | // Writes a localized value. |
2049 | | FMT_API auto write_loc(appender out, loc_value value, const format_specs& specs, |
2050 | | locale_ref loc) -> bool; |
2051 | | #endif |
2052 | | template <typename OutputIt> |
2053 | | inline auto write_loc(OutputIt, loc_value, const format_specs&, locale_ref) |
2054 | | -> bool { |
2055 | | return false; |
2056 | | } |
2057 | | |
2058 | | template <typename UInt> struct write_int_arg { |
2059 | | UInt abs_value; |
2060 | | unsigned prefix; |
2061 | | }; |
2062 | | |
2063 | | template <typename T> |
2064 | | FMT_CONSTEXPR auto make_write_int_arg(T value, sign s) |
2065 | 59.4k | -> write_int_arg<uint32_or_64_or_128_t<T>> { |
2066 | 59.4k | auto prefix = 0u; |
2067 | 59.4k | auto abs_value = static_cast<uint32_or_64_or_128_t<T>>(value); |
2068 | 59.4k | if (is_negative(value)) { |
2069 | 17.5k | prefix = 0x01000000 | '-'; |
2070 | 17.5k | abs_value = 0 - abs_value; |
2071 | 41.8k | } else { |
2072 | 41.8k | constexpr const unsigned prefixes[4] = {0, 0, 0x1000000u | '+', |
2073 | 41.8k | 0x1000000u | ' '}; |
2074 | 41.8k | prefix = prefixes[static_cast<int>(s)]; |
2075 | 41.8k | } |
2076 | 59.4k | return {abs_value, prefix}; |
2077 | 59.4k | } fmt::v11::detail::write_int_arg<std::__1::conditional<(((num_bits<int>)())<=(32))&&(!(0)), unsigned int, std::__1::conditional<((num_bits<int>)())<=(64), unsigned long, unsigned __int128>::type>::type> fmt::v11::detail::make_write_int_arg<int>(int, fmt::v11::sign) Line | Count | Source | 2065 | 20.4k | -> write_int_arg<uint32_or_64_or_128_t<T>> { | 2066 | 20.4k | auto prefix = 0u; | 2067 | 20.4k | auto abs_value = static_cast<uint32_or_64_or_128_t<T>>(value); | 2068 | 20.4k | if (is_negative(value)) { | 2069 | 8.79k | prefix = 0x01000000 | '-'; | 2070 | 8.79k | abs_value = 0 - abs_value; | 2071 | 11.6k | } else { | 2072 | 11.6k | constexpr const unsigned prefixes[4] = {0, 0, 0x1000000u | '+', | 2073 | 11.6k | 0x1000000u | ' '}; | 2074 | 11.6k | prefix = prefixes[static_cast<int>(s)]; | 2075 | 11.6k | } | 2076 | 20.4k | return {abs_value, prefix}; | 2077 | 20.4k | } |
fmt::v11::detail::write_int_arg<std::__1::conditional<(((num_bits<unsigned int>)())<=(32))&&(!(0)), unsigned int, std::__1::conditional<((num_bits<unsigned int>)())<=(64), unsigned long, unsigned __int128>::type>::type> fmt::v11::detail::make_write_int_arg<unsigned int>(unsigned int, fmt::v11::sign) Line | Count | Source | 2065 | 10.0k | -> write_int_arg<uint32_or_64_or_128_t<T>> { | 2066 | 10.0k | auto prefix = 0u; | 2067 | 10.0k | auto abs_value = static_cast<uint32_or_64_or_128_t<T>>(value); | 2068 | 10.0k | if (is_negative(value)) { | 2069 | 0 | prefix = 0x01000000 | '-'; | 2070 | 0 | abs_value = 0 - abs_value; | 2071 | 10.0k | } else { | 2072 | 10.0k | constexpr const unsigned prefixes[4] = {0, 0, 0x1000000u | '+', | 2073 | 10.0k | 0x1000000u | ' '}; | 2074 | 10.0k | prefix = prefixes[static_cast<int>(s)]; | 2075 | 10.0k | } | 2076 | 10.0k | return {abs_value, prefix}; | 2077 | 10.0k | } |
fmt::v11::detail::write_int_arg<std::__1::conditional<(((num_bits<long long>)())<=(32))&&(!(0)), unsigned int, std::__1::conditional<((num_bits<long long>)())<=(64), unsigned long, unsigned __int128>::type>::type> fmt::v11::detail::make_write_int_arg<long long>(long long, fmt::v11::sign) Line | Count | Source | 2065 | 19.6k | -> write_int_arg<uint32_or_64_or_128_t<T>> { | 2066 | 19.6k | auto prefix = 0u; | 2067 | 19.6k | auto abs_value = static_cast<uint32_or_64_or_128_t<T>>(value); | 2068 | 19.6k | if (is_negative(value)) { | 2069 | 8.77k | prefix = 0x01000000 | '-'; | 2070 | 8.77k | abs_value = 0 - abs_value; | 2071 | 10.8k | } else { | 2072 | 10.8k | constexpr const unsigned prefixes[4] = {0, 0, 0x1000000u | '+', | 2073 | 10.8k | 0x1000000u | ' '}; | 2074 | 10.8k | prefix = prefixes[static_cast<int>(s)]; | 2075 | 10.8k | } | 2076 | 19.6k | return {abs_value, prefix}; | 2077 | 19.6k | } |
fmt::v11::detail::write_int_arg<std::__1::conditional<(((num_bits<unsigned long long>)())<=(32))&&(!(0)), unsigned int, std::__1::conditional<((num_bits<unsigned long long>)())<=(64), unsigned long, unsigned __int128>::type>::type> fmt::v11::detail::make_write_int_arg<unsigned long long>(unsigned long long, fmt::v11::sign) Line | Count | Source | 2065 | 6.90k | -> write_int_arg<uint32_or_64_or_128_t<T>> { | 2066 | 6.90k | auto prefix = 0u; | 2067 | 6.90k | auto abs_value = static_cast<uint32_or_64_or_128_t<T>>(value); | 2068 | 6.90k | if (is_negative(value)) { | 2069 | 0 | prefix = 0x01000000 | '-'; | 2070 | 0 | abs_value = 0 - abs_value; | 2071 | 6.90k | } else { | 2072 | 6.90k | constexpr const unsigned prefixes[4] = {0, 0, 0x1000000u | '+', | 2073 | 6.90k | 0x1000000u | ' '}; | 2074 | 6.90k | prefix = prefixes[static_cast<int>(s)]; | 2075 | 6.90k | } | 2076 | 6.90k | return {abs_value, prefix}; | 2077 | 6.90k | } |
Unexecuted instantiation: fmt::v11::detail::write_int_arg<std::__1::conditional<(((num_bits<__int128>)())<=(32))&&(!(0)), unsigned int, std::__1::conditional<((num_bits<__int128>)())<=(64), unsigned long, unsigned __int128>::type>::type> fmt::v11::detail::make_write_int_arg<__int128>(__int128, fmt::v11::sign) Unexecuted instantiation: fmt::v11::detail::write_int_arg<std::__1::conditional<(((num_bits<unsigned __int128>)())<=(32))&&(!(0)), unsigned int, std::__1::conditional<((num_bits<unsigned __int128>)())<=(64), unsigned long, unsigned __int128>::type>::type> fmt::v11::detail::make_write_int_arg<unsigned __int128>(unsigned __int128, fmt::v11::sign) fmt::v11::detail::write_int_arg<std::__1::conditional<(((num_bits<unsigned char>)())<=(32))&&(!(0)), unsigned int, std::__1::conditional<((num_bits<unsigned char>)())<=(64), unsigned long, unsigned __int128>::type>::type> fmt::v11::detail::make_write_int_arg<unsigned char>(unsigned char, fmt::v11::sign) Line | Count | Source | 2065 | 2.39k | -> write_int_arg<uint32_or_64_or_128_t<T>> { | 2066 | 2.39k | auto prefix = 0u; | 2067 | 2.39k | auto abs_value = static_cast<uint32_or_64_or_128_t<T>>(value); | 2068 | 2.39k | if (is_negative(value)) { | 2069 | 0 | prefix = 0x01000000 | '-'; | 2070 | 0 | abs_value = 0 - abs_value; | 2071 | 2.39k | } else { | 2072 | 2.39k | constexpr const unsigned prefixes[4] = {0, 0, 0x1000000u | '+', | 2073 | 2.39k | 0x1000000u | ' '}; | 2074 | 2.39k | prefix = prefixes[static_cast<int>(s)]; | 2075 | 2.39k | } | 2076 | 2.39k | return {abs_value, prefix}; | 2077 | 2.39k | } |
|
2078 | | |
2079 | | template <typename Char = char> struct loc_writer { |
2080 | | basic_appender<Char> out; |
2081 | | const format_specs& specs; |
2082 | | std::basic_string<Char> sep; |
2083 | | std::string grouping; |
2084 | | std::basic_string<Char> decimal_point; |
2085 | | |
2086 | | template <typename T, FMT_ENABLE_IF(is_integer<T>::value)> |
2087 | 14.9k | auto operator()(T value) -> bool { |
2088 | 14.9k | auto arg = make_write_int_arg(value, specs.sign()); |
2089 | 14.9k | write_int(out, static_cast<uint64_or_128_t<T>>(arg.abs_value), arg.prefix, |
2090 | 14.9k | specs, digit_grouping<Char>(grouping, sep)); |
2091 | 14.9k | return true; |
2092 | 14.9k | } _ZN3fmt3v116detail10loc_writerIcEclIiTnNSt3__19enable_ifIXsr10is_integerIT_EE5valueEiE4typeELi0EEEbS7_ Line | Count | Source | 2087 | 5.71k | auto operator()(T value) -> bool { | 2088 | 5.71k | auto arg = make_write_int_arg(value, specs.sign()); | 2089 | 5.71k | write_int(out, static_cast<uint64_or_128_t<T>>(arg.abs_value), arg.prefix, | 2090 | 5.71k | specs, digit_grouping<Char>(grouping, sep)); | 2091 | 5.71k | return true; | 2092 | 5.71k | } |
_ZN3fmt3v116detail10loc_writerIcEclIjTnNSt3__19enable_ifIXsr10is_integerIT_EE5valueEiE4typeELi0EEEbS7_ Line | Count | Source | 2087 | 3.21k | auto operator()(T value) -> bool { | 2088 | 3.21k | auto arg = make_write_int_arg(value, specs.sign()); | 2089 | 3.21k | write_int(out, static_cast<uint64_or_128_t<T>>(arg.abs_value), arg.prefix, | 2090 | 3.21k | specs, digit_grouping<Char>(grouping, sep)); | 2091 | 3.21k | return true; | 2092 | 3.21k | } |
_ZN3fmt3v116detail10loc_writerIcEclIxTnNSt3__19enable_ifIXsr10is_integerIT_EE5valueEiE4typeELi0EEEbS7_ Line | Count | Source | 2087 | 4.42k | auto operator()(T value) -> bool { | 2088 | 4.42k | auto arg = make_write_int_arg(value, specs.sign()); | 2089 | 4.42k | write_int(out, static_cast<uint64_or_128_t<T>>(arg.abs_value), arg.prefix, | 2090 | 4.42k | specs, digit_grouping<Char>(grouping, sep)); | 2091 | 4.42k | return true; | 2092 | 4.42k | } |
_ZN3fmt3v116detail10loc_writerIcEclIyTnNSt3__19enable_ifIXsr10is_integerIT_EE5valueEiE4typeELi0EEEbS7_ Line | Count | Source | 2087 | 1.55k | auto operator()(T value) -> bool { | 2088 | 1.55k | auto arg = make_write_int_arg(value, specs.sign()); | 2089 | 1.55k | write_int(out, static_cast<uint64_or_128_t<T>>(arg.abs_value), arg.prefix, | 2090 | 1.55k | specs, digit_grouping<Char>(grouping, sep)); | 2091 | 1.55k | return true; | 2092 | 1.55k | } |
Unexecuted instantiation: _ZN3fmt3v116detail10loc_writerIcEclInTnNSt3__19enable_ifIXsr10is_integerIT_EE5valueEiE4typeELi0EEEbS7_ Unexecuted instantiation: _ZN3fmt3v116detail10loc_writerIcEclIoTnNSt3__19enable_ifIXsr10is_integerIT_EE5valueEiE4typeELi0EEEbS7_ |
2093 | | |
2094 | | template <typename T, FMT_ENABLE_IF(!is_integer<T>::value)> |
2095 | 2.42k | auto operator()(T) -> bool { |
2096 | 2.42k | return false; |
2097 | 2.42k | } Unexecuted instantiation: _ZN3fmt3v116detail10loc_writerIcEclIbTnNSt3__19enable_ifIXntsr10is_integerIT_EE5valueEiE4typeELi0EEEbS7_ Unexecuted instantiation: _ZN3fmt3v116detail10loc_writerIcEclIcTnNSt3__19enable_ifIXntsr10is_integerIT_EE5valueEiE4typeELi0EEEbS7_ _ZN3fmt3v116detail10loc_writerIcEclIfTnNSt3__19enable_ifIXntsr10is_integerIT_EE5valueEiE4typeELi0EEEbS7_ Line | Count | Source | 2095 | 659 | auto operator()(T) -> bool { | 2096 | 659 | return false; | 2097 | 659 | } |
_ZN3fmt3v116detail10loc_writerIcEclIdTnNSt3__19enable_ifIXntsr10is_integerIT_EE5valueEiE4typeELi0EEEbS7_ Line | Count | Source | 2095 | 1.07k | auto operator()(T) -> bool { | 2096 | 1.07k | return false; | 2097 | 1.07k | } |
_ZN3fmt3v116detail10loc_writerIcEclIeTnNSt3__19enable_ifIXntsr10is_integerIT_EE5valueEiE4typeELi0EEEbS7_ Line | Count | Source | 2095 | 696 | auto operator()(T) -> bool { | 2096 | 696 | return false; | 2097 | 696 | } |
Unexecuted instantiation: _ZN3fmt3v116detail10loc_writerIcEclIPKcTnNSt3__19enable_ifIXntsr10is_integerIT_EE5valueEiE4typeELi0EEEbS9_ Unexecuted instantiation: _ZN3fmt3v116detail10loc_writerIcEclINS0_17basic_string_viewIcEETnNSt3__19enable_ifIXntsr10is_integerIT_EE5valueEiE4typeELi0EEEbS9_ Unexecuted instantiation: _ZN3fmt3v116detail10loc_writerIcEclIPKvTnNSt3__19enable_ifIXntsr10is_integerIT_EE5valueEiE4typeELi0EEEbS9_ Unexecuted instantiation: _ZN3fmt3v116detail10loc_writerIcEclINS0_16basic_format_argINS0_7contextEE6handleETnNSt3__19enable_ifIXntsr10is_integerIT_EE5valueEiE4typeELi0EEEbSB_ Unexecuted instantiation: _ZN3fmt3v116detail10loc_writerIcEclINS0_9monostateETnNSt3__19enable_ifIXntsr10is_integerIT_EE5valueEiE4typeELi0EEEbS8_ |
2098 | | }; |
2099 | | |
2100 | | // Size and padding computation separate from write_int to avoid template bloat. |
2101 | | struct size_padding { |
2102 | | unsigned size; |
2103 | | unsigned padding; |
2104 | | |
2105 | | FMT_CONSTEXPR size_padding(int num_digits, unsigned prefix, |
2106 | | const format_specs& specs) |
2107 | 16.7k | : size((prefix >> 24) + to_unsigned(num_digits)), padding(0) { |
2108 | 16.7k | if (specs.align() == align::numeric) { |
2109 | 2.73k | auto width = to_unsigned(specs.width); |
2110 | 2.73k | if (width > size) { |
2111 | 1.81k | padding = width - size; |
2112 | 1.81k | size = width; |
2113 | 1.81k | } |
2114 | 13.9k | } else if (specs.precision > num_digits) { |
2115 | 0 | size = (prefix >> 24) + to_unsigned(specs.precision); |
2116 | 0 | padding = to_unsigned(specs.precision - num_digits); |
2117 | 0 | } |
2118 | 16.7k | } |
2119 | | }; |
2120 | | |
2121 | | template <typename Char, typename OutputIt, typename T> |
2122 | | FMT_CONSTEXPR FMT_INLINE auto write_int(OutputIt out, write_int_arg<T> arg, |
2123 | 44.5k | const format_specs& specs) -> OutputIt { |
2124 | 44.5k | static_assert(std::is_same<T, uint32_or_64_or_128_t<T>>::value, ""); |
2125 | | |
2126 | 44.5k | constexpr int buffer_size = num_bits<T>(); |
2127 | 44.5k | char buffer[buffer_size]; |
2128 | 44.5k | if (is_constant_evaluated()) fill_n(buffer, buffer_size, '\0'); |
2129 | 44.5k | const char* begin = nullptr; |
2130 | 44.5k | const char* end = buffer + buffer_size; |
2131 | | |
2132 | 44.5k | auto abs_value = arg.abs_value; |
2133 | 44.5k | auto prefix = arg.prefix; |
2134 | 44.5k | switch (specs.type()) { |
2135 | 0 | default: FMT_ASSERT(false, ""); FMT_FALLTHROUGH; |
2136 | 19.6k | case presentation_type::none: |
2137 | 20.9k | case presentation_type::dec: |
2138 | 20.9k | begin = do_format_decimal(buffer, abs_value, buffer_size); |
2139 | 20.9k | break; |
2140 | 7.68k | case presentation_type::hex: |
2141 | 7.68k | begin = do_format_base2e(4, buffer, abs_value, buffer_size, specs.upper()); |
2142 | 7.68k | if (specs.alt()) |
2143 | 4.41k | prefix_append(prefix, unsigned(specs.upper() ? 'X' : 'x') << 8 | '0'); |
2144 | 7.68k | break; |
2145 | 7.37k | case presentation_type::oct: { |
2146 | 7.37k | begin = do_format_base2e(3, buffer, abs_value, buffer_size); |
2147 | | // Octal prefix '0' is counted as a digit, so only add it if precision |
2148 | | // is not greater than the number of digits. |
2149 | 7.37k | auto num_digits = end - begin; |
2150 | 7.37k | if (specs.alt() && specs.precision <= num_digits && abs_value != 0) |
2151 | 4.18k | prefix_append(prefix, '0'); |
2152 | 7.37k | break; |
2153 | 19.6k | } |
2154 | 6.87k | case presentation_type::bin: |
2155 | 6.87k | begin = do_format_base2e(1, buffer, abs_value, buffer_size); |
2156 | 6.87k | if (specs.alt()) |
2157 | 4.45k | prefix_append(prefix, unsigned(specs.upper() ? 'B' : 'b') << 8 | '0'); |
2158 | 6.87k | break; |
2159 | 1.64k | case presentation_type::chr: |
2160 | 1.64k | return write_char<Char>(out, static_cast<Char>(abs_value), specs); |
2161 | 44.5k | } |
2162 | | |
2163 | | // Write an integer in the format |
2164 | | // <left-padding><prefix><numeric-padding><digits><right-padding> |
2165 | | // prefix contains chars in three lower bytes and the size in the fourth byte. |
2166 | 42.8k | int num_digits = static_cast<int>(end - begin); |
2167 | | // Slightly faster check for specs.width == 0 && specs.precision == -1. |
2168 | 42.8k | if ((specs.width | (specs.precision + 1)) == 0) { |
2169 | 26.1k | auto it = reserve(out, to_unsigned(num_digits) + (prefix >> 24)); |
2170 | 50.9k | for (unsigned p = prefix & 0xffffff; p != 0; p >>= 8) |
2171 | 24.7k | *it++ = static_cast<Char>(p & 0xff); |
2172 | 26.1k | return base_iterator(out, copy<Char>(begin, end, it)); |
2173 | 26.1k | } |
2174 | 16.7k | auto sp = size_padding(num_digits, prefix, specs); |
2175 | 16.7k | unsigned padding = sp.padding; |
2176 | 16.7k | return write_padded<Char, align::right>( |
2177 | 16.7k | out, specs, sp.size, [=](reserve_iterator<OutputIt> it) { |
2178 | 26.6k | for (unsigned p = prefix & 0xffffff; p != 0; p >>= 8) |
2179 | 10.1k | *it++ = static_cast<Char>(p & 0xff); |
2180 | 16.4k | it = detail::fill_n(it, padding, static_cast<Char>('0')); |
2181 | 16.4k | return copy<Char>(begin, end, it); |
2182 | 16.4k | }); fmt::v11::detail::write_int<char, fmt::v11::basic_appender<char>, unsigned int>(fmt::v11::basic_appender<char>, fmt::v11::detail::write_int_arg<unsigned int>, fmt::v11::format_specs const&)::{lambda(fmt::v11::basic_appender<char>)#1}::operator()(fmt::v11::basic_appender<char>) const Line | Count | Source | 2177 | 8.82k | out, specs, sp.size, [=](reserve_iterator<OutputIt> it) { | 2178 | 14.3k | for (unsigned p = prefix & 0xffffff; p != 0; p >>= 8) | 2179 | 5.47k | *it++ = static_cast<Char>(p & 0xff); | 2180 | 8.82k | it = detail::fill_n(it, padding, static_cast<Char>('0')); | 2181 | 8.82k | return copy<Char>(begin, end, it); | 2182 | 8.82k | }); |
fmt::v11::detail::write_int<char, fmt::v11::basic_appender<char>, unsigned long>(fmt::v11::basic_appender<char>, fmt::v11::detail::write_int_arg<unsigned long>, fmt::v11::format_specs const&)::{lambda(fmt::v11::basic_appender<char>)#1}::operator()(fmt::v11::basic_appender<char>) const Line | Count | Source | 2177 | 7.62k | out, specs, sp.size, [=](reserve_iterator<OutputIt> it) { | 2178 | 12.3k | for (unsigned p = prefix & 0xffffff; p != 0; p >>= 8) | 2179 | 4.70k | *it++ = static_cast<Char>(p & 0xff); | 2180 | 7.62k | it = detail::fill_n(it, padding, static_cast<Char>('0')); | 2181 | 7.62k | return copy<Char>(begin, end, it); | 2182 | 7.62k | }); |
Unexecuted instantiation: fmt::v11::detail::write_int<char, fmt::v11::basic_appender<char>, unsigned __int128>(fmt::v11::basic_appender<char>, fmt::v11::detail::write_int_arg<unsigned __int128>, fmt::v11::format_specs const&)::{lambda(fmt::v11::basic_appender<char>)#1}::operator()(fmt::v11::basic_appender<char>) const |
2183 | 42.8k | } fmt::v11::basic_appender<char> fmt::v11::detail::write_int<char, fmt::v11::basic_appender<char>, unsigned int>(fmt::v11::basic_appender<char>, fmt::v11::detail::write_int_arg<unsigned int>, fmt::v11::format_specs const&) Line | Count | Source | 2123 | 23.9k | const format_specs& specs) -> OutputIt { | 2124 | 23.9k | static_assert(std::is_same<T, uint32_or_64_or_128_t<T>>::value, ""); | 2125 | | | 2126 | 23.9k | constexpr int buffer_size = num_bits<T>(); | 2127 | 23.9k | char buffer[buffer_size]; | 2128 | 23.9k | if (is_constant_evaluated()) fill_n(buffer, buffer_size, '\0'); | 2129 | 23.9k | const char* begin = nullptr; | 2130 | 23.9k | const char* end = buffer + buffer_size; | 2131 | | | 2132 | 23.9k | auto abs_value = arg.abs_value; | 2133 | 23.9k | auto prefix = arg.prefix; | 2134 | 23.9k | switch (specs.type()) { | 2135 | 0 | default: FMT_ASSERT(false, ""); FMT_FALLTHROUGH; | 2136 | 10.4k | case presentation_type::none: | 2137 | 11.1k | case presentation_type::dec: | 2138 | 11.1k | begin = do_format_decimal(buffer, abs_value, buffer_size); | 2139 | 11.1k | break; | 2140 | 4.77k | case presentation_type::hex: | 2141 | 4.77k | begin = do_format_base2e(4, buffer, abs_value, buffer_size, specs.upper()); | 2142 | 4.77k | if (specs.alt()) | 2143 | 2.41k | prefix_append(prefix, unsigned(specs.upper() ? 'X' : 'x') << 8 | '0'); | 2144 | 4.77k | break; | 2145 | 3.52k | case presentation_type::oct: { | 2146 | 3.52k | begin = do_format_base2e(3, buffer, abs_value, buffer_size); | 2147 | | // Octal prefix '0' is counted as a digit, so only add it if precision | 2148 | | // is not greater than the number of digits. | 2149 | 3.52k | auto num_digits = end - begin; | 2150 | 3.52k | if (specs.alt() && specs.precision <= num_digits && abs_value != 0) | 2151 | 2.15k | prefix_append(prefix, '0'); | 2152 | 3.52k | break; | 2153 | 10.4k | } | 2154 | 3.64k | case presentation_type::bin: | 2155 | 3.64k | begin = do_format_base2e(1, buffer, abs_value, buffer_size); | 2156 | 3.64k | if (specs.alt()) | 2157 | 2.33k | prefix_append(prefix, unsigned(specs.upper() ? 'B' : 'b') << 8 | '0'); | 2158 | 3.64k | break; | 2159 | 908 | case presentation_type::chr: | 2160 | 908 | return write_char<Char>(out, static_cast<Char>(abs_value), specs); | 2161 | 23.9k | } | 2162 | | | 2163 | | // Write an integer in the format | 2164 | | // <left-padding><prefix><numeric-padding><digits><right-padding> | 2165 | | // prefix contains chars in three lower bytes and the size in the fourth byte. | 2166 | 23.0k | int num_digits = static_cast<int>(end - begin); | 2167 | | // Slightly faster check for specs.width == 0 && specs.precision == -1. | 2168 | 23.0k | if ((specs.width | (specs.precision + 1)) == 0) { | 2169 | 14.0k | auto it = reserve(out, to_unsigned(num_digits) + (prefix >> 24)); | 2170 | 26.7k | for (unsigned p = prefix & 0xffffff; p != 0; p >>= 8) | 2171 | 12.6k | *it++ = static_cast<Char>(p & 0xff); | 2172 | 14.0k | return base_iterator(out, copy<Char>(begin, end, it)); | 2173 | 14.0k | } | 2174 | 8.98k | auto sp = size_padding(num_digits, prefix, specs); | 2175 | 8.98k | unsigned padding = sp.padding; | 2176 | 8.98k | return write_padded<Char, align::right>( | 2177 | 8.98k | out, specs, sp.size, [=](reserve_iterator<OutputIt> it) { | 2178 | 8.98k | for (unsigned p = prefix & 0xffffff; p != 0; p >>= 8) | 2179 | 8.98k | *it++ = static_cast<Char>(p & 0xff); | 2180 | 8.98k | it = detail::fill_n(it, padding, static_cast<Char>('0')); | 2181 | 8.98k | return copy<Char>(begin, end, it); | 2182 | 8.98k | }); | 2183 | 23.0k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_int<char, fmt::v11::basic_appender<char>, unsigned long>(fmt::v11::basic_appender<char>, fmt::v11::detail::write_int_arg<unsigned long>, fmt::v11::format_specs const&) Line | Count | Source | 2123 | 20.5k | const format_specs& specs) -> OutputIt { | 2124 | 20.5k | static_assert(std::is_same<T, uint32_or_64_or_128_t<T>>::value, ""); | 2125 | | | 2126 | 20.5k | constexpr int buffer_size = num_bits<T>(); | 2127 | 20.5k | char buffer[buffer_size]; | 2128 | 20.5k | if (is_constant_evaluated()) fill_n(buffer, buffer_size, '\0'); | 2129 | 20.5k | const char* begin = nullptr; | 2130 | 20.5k | const char* end = buffer + buffer_size; | 2131 | | | 2132 | 20.5k | auto abs_value = arg.abs_value; | 2133 | 20.5k | auto prefix = arg.prefix; | 2134 | 20.5k | switch (specs.type()) { | 2135 | 0 | default: FMT_ASSERT(false, ""); FMT_FALLTHROUGH; | 2136 | 9.16k | case presentation_type::none: | 2137 | 9.80k | case presentation_type::dec: | 2138 | 9.80k | begin = do_format_decimal(buffer, abs_value, buffer_size); | 2139 | 9.80k | break; | 2140 | 2.91k | case presentation_type::hex: | 2141 | 2.91k | begin = do_format_base2e(4, buffer, abs_value, buffer_size, specs.upper()); | 2142 | 2.91k | if (specs.alt()) | 2143 | 2.00k | prefix_append(prefix, unsigned(specs.upper() ? 'X' : 'x') << 8 | '0'); | 2144 | 2.91k | break; | 2145 | 3.84k | case presentation_type::oct: { | 2146 | 3.84k | begin = do_format_base2e(3, buffer, abs_value, buffer_size); | 2147 | | // Octal prefix '0' is counted as a digit, so only add it if precision | 2148 | | // is not greater than the number of digits. | 2149 | 3.84k | auto num_digits = end - begin; | 2150 | 3.84k | if (specs.alt() && specs.precision <= num_digits && abs_value != 0) | 2151 | 2.02k | prefix_append(prefix, '0'); | 2152 | 3.84k | break; | 2153 | 9.16k | } | 2154 | 3.22k | case presentation_type::bin: | 2155 | 3.22k | begin = do_format_base2e(1, buffer, abs_value, buffer_size); | 2156 | 3.22k | if (specs.alt()) | 2157 | 2.12k | prefix_append(prefix, unsigned(specs.upper() ? 'B' : 'b') << 8 | '0'); | 2158 | 3.22k | break; | 2159 | 732 | case presentation_type::chr: | 2160 | 732 | return write_char<Char>(out, static_cast<Char>(abs_value), specs); | 2161 | 20.5k | } | 2162 | | | 2163 | | // Write an integer in the format | 2164 | | // <left-padding><prefix><numeric-padding><digits><right-padding> | 2165 | | // prefix contains chars in three lower bytes and the size in the fourth byte. | 2166 | 19.7k | int num_digits = static_cast<int>(end - begin); | 2167 | | // Slightly faster check for specs.width == 0 && specs.precision == -1. | 2168 | 19.7k | if ((specs.width | (specs.precision + 1)) == 0) { | 2169 | 12.0k | auto it = reserve(out, to_unsigned(num_digits) + (prefix >> 24)); | 2170 | 24.1k | for (unsigned p = prefix & 0xffffff; p != 0; p >>= 8) | 2171 | 12.1k | *it++ = static_cast<Char>(p & 0xff); | 2172 | 12.0k | return base_iterator(out, copy<Char>(begin, end, it)); | 2173 | 12.0k | } | 2174 | 7.74k | auto sp = size_padding(num_digits, prefix, specs); | 2175 | 7.74k | unsigned padding = sp.padding; | 2176 | 7.74k | return write_padded<Char, align::right>( | 2177 | 7.74k | out, specs, sp.size, [=](reserve_iterator<OutputIt> it) { | 2178 | 7.74k | for (unsigned p = prefix & 0xffffff; p != 0; p >>= 8) | 2179 | 7.74k | *it++ = static_cast<Char>(p & 0xff); | 2180 | 7.74k | it = detail::fill_n(it, padding, static_cast<Char>('0')); | 2181 | 7.74k | return copy<Char>(begin, end, it); | 2182 | 7.74k | }); | 2183 | 19.7k | } |
Unexecuted instantiation: fmt::v11::basic_appender<char> fmt::v11::detail::write_int<char, fmt::v11::basic_appender<char>, unsigned __int128>(fmt::v11::basic_appender<char>, fmt::v11::detail::write_int_arg<unsigned __int128>, fmt::v11::format_specs const&) |
2184 | | |
2185 | | template <typename Char, typename OutputIt, typename T> |
2186 | | FMT_CONSTEXPR FMT_NOINLINE auto write_int_noinline(OutputIt out, |
2187 | | write_int_arg<T> arg, |
2188 | | const format_specs& specs) |
2189 | 44.5k | -> OutputIt { |
2190 | 44.5k | return write_int<Char>(out, arg, specs); |
2191 | 44.5k | } fmt::v11::basic_appender<char> fmt::v11::detail::write_int_noinline<char, fmt::v11::basic_appender<char>, unsigned int>(fmt::v11::basic_appender<char>, fmt::v11::detail::write_int_arg<unsigned int>, fmt::v11::format_specs const&) Line | Count | Source | 2189 | 23.9k | -> OutputIt { | 2190 | 23.9k | return write_int<Char>(out, arg, specs); | 2191 | 23.9k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_int_noinline<char, fmt::v11::basic_appender<char>, unsigned long>(fmt::v11::basic_appender<char>, fmt::v11::detail::write_int_arg<unsigned long>, fmt::v11::format_specs const&) Line | Count | Source | 2189 | 20.5k | -> OutputIt { | 2190 | 20.5k | return write_int<Char>(out, arg, specs); | 2191 | 20.5k | } |
Unexecuted instantiation: fmt::v11::basic_appender<char> fmt::v11::detail::write_int_noinline<char, fmt::v11::basic_appender<char>, unsigned __int128>(fmt::v11::basic_appender<char>, fmt::v11::detail::write_int_arg<unsigned __int128>, fmt::v11::format_specs const&) |
2192 | | |
2193 | | template <typename Char, typename T, |
2194 | | FMT_ENABLE_IF(is_integral<T>::value && |
2195 | | !std::is_same<T, bool>::value && |
2196 | | !std::is_same<T, Char>::value)> |
2197 | | FMT_CONSTEXPR FMT_INLINE auto write(basic_appender<Char> out, T value, |
2198 | | const format_specs& specs, locale_ref loc) |
2199 | 59.4k | -> basic_appender<Char> { |
2200 | 59.4k | if (specs.localized() && write_loc(out, value, specs, loc)) return out; |
2201 | 44.6k | return write_int_noinline<Char>(out, make_write_int_arg(value, specs.sign()), |
2202 | 44.6k | specs); |
2203 | 59.4k | } _ZN3fmt3v116detail5writeIciTnNSt3__19enable_ifIXaaaasr11is_integralIT0_EE5valuentsr3std7is_sameIS5_bEE5valuentsr3std7is_sameIS5_T_EE5valueEiE4typeELi0EEENS0_14basic_appenderIS6_EESA_S5_RKNS0_12format_specsENS1_10locale_refE Line | Count | Source | 2199 | 20.4k | -> basic_appender<Char> { | 2200 | 20.4k | if (specs.localized() && write_loc(out, value, specs, loc)) return out; | 2201 | 14.8k | return write_int_noinline<Char>(out, make_write_int_arg(value, specs.sign()), | 2202 | 14.8k | specs); | 2203 | 20.4k | } |
_ZN3fmt3v116detail5writeIcjTnNSt3__19enable_ifIXaaaasr11is_integralIT0_EE5valuentsr3std7is_sameIS5_bEE5valuentsr3std7is_sameIS5_T_EE5valueEiE4typeELi0EEENS0_14basic_appenderIS6_EESA_S5_RKNS0_12format_specsENS1_10locale_refE Line | Count | Source | 2199 | 8.62k | -> basic_appender<Char> { | 2200 | 8.62k | if (specs.localized() && write_loc(out, value, specs, loc)) return out; | 2201 | 6.83k | return write_int_noinline<Char>(out, make_write_int_arg(value, specs.sign()), | 2202 | 6.83k | specs); | 2203 | 8.62k | } |
_ZN3fmt3v116detail5writeIcxTnNSt3__19enable_ifIXaaaasr11is_integralIT0_EE5valuentsr3std7is_sameIS5_bEE5valuentsr3std7is_sameIS5_T_EE5valueEiE4typeELi0EEENS0_14basic_appenderIS6_EESA_S5_RKNS0_12format_specsENS1_10locale_refE Line | Count | Source | 2199 | 19.6k | -> basic_appender<Char> { | 2200 | 19.6k | if (specs.localized() && write_loc(out, value, specs, loc)) return out; | 2201 | 15.2k | return write_int_noinline<Char>(out, make_write_int_arg(value, specs.sign()), | 2202 | 15.2k | specs); | 2203 | 19.6k | } |
_ZN3fmt3v116detail5writeIcyTnNSt3__19enable_ifIXaaaasr11is_integralIT0_EE5valuentsr3std7is_sameIS5_bEE5valuentsr3std7is_sameIS5_T_EE5valueEiE4typeELi0EEENS0_14basic_appenderIS6_EESA_S5_RKNS0_12format_specsENS1_10locale_refE Line | Count | Source | 2199 | 6.90k | -> basic_appender<Char> { | 2200 | 6.90k | if (specs.localized() && write_loc(out, value, specs, loc)) return out; | 2201 | 5.37k | return write_int_noinline<Char>(out, make_write_int_arg(value, specs.sign()), | 2202 | 5.37k | specs); | 2203 | 6.90k | } |
Unexecuted instantiation: _ZN3fmt3v116detail5writeIcnTnNSt3__19enable_ifIXaaaasr11is_integralIT0_EE5valuentsr3std7is_sameIS5_bEE5valuentsr3std7is_sameIS5_T_EE5valueEiE4typeELi0EEENS0_14basic_appenderIS6_EESA_S5_RKNS0_12format_specsENS1_10locale_refE Unexecuted instantiation: _ZN3fmt3v116detail5writeIcoTnNSt3__19enable_ifIXaaaasr11is_integralIT0_EE5valuentsr3std7is_sameIS5_bEE5valuentsr3std7is_sameIS5_T_EE5valueEiE4typeELi0EEENS0_14basic_appenderIS6_EESA_S5_RKNS0_12format_specsENS1_10locale_refE _ZN3fmt3v116detail5writeIchTnNSt3__19enable_ifIXaaaasr11is_integralIT0_EE5valuentsr3std7is_sameIS5_bEE5valuentsr3std7is_sameIS5_T_EE5valueEiE4typeELi0EEENS0_14basic_appenderIS6_EESA_S5_RKNS0_12format_specsENS1_10locale_refE Line | Count | Source | 2199 | 3.81k | -> basic_appender<Char> { | 2200 | 3.81k | if (specs.localized() && write_loc(out, value, specs, loc)) return out; | 2201 | 2.39k | return write_int_noinline<Char>(out, make_write_int_arg(value, specs.sign()), | 2202 | 2.39k | specs); | 2203 | 3.81k | } |
|
2204 | | |
2205 | | // An inlined version of write used in format string compilation. |
2206 | | template <typename Char, typename OutputIt, typename T, |
2207 | | FMT_ENABLE_IF(is_integral<T>::value && |
2208 | | !std::is_same<T, bool>::value && |
2209 | | !std::is_same<T, Char>::value && |
2210 | | !std::is_same<OutputIt, basic_appender<Char>>::value)> |
2211 | | FMT_CONSTEXPR FMT_INLINE auto write(OutputIt out, T value, |
2212 | | const format_specs& specs, locale_ref loc) |
2213 | | -> OutputIt { |
2214 | | if (specs.localized() && write_loc(out, value, specs, loc)) return out; |
2215 | | return write_int<Char>(out, make_write_int_arg(value, specs.sign()), specs); |
2216 | | } |
2217 | | |
2218 | | template <typename Char, typename OutputIt> |
2219 | | FMT_CONSTEXPR auto write(OutputIt out, basic_string_view<Char> s, |
2220 | 319k | const format_specs& specs) -> OutputIt { |
2221 | 319k | auto data = s.data(); |
2222 | 319k | auto size = s.size(); |
2223 | 319k | if (specs.precision >= 0 && to_unsigned(specs.precision) < size) |
2224 | 0 | size = code_point_index(s, to_unsigned(specs.precision)); |
2225 | | |
2226 | 319k | bool is_debug = specs.type() == presentation_type::debug; |
2227 | 319k | if (is_debug) { |
2228 | 0 | auto buf = counting_buffer<Char>(); |
2229 | 0 | write_escaped_string(basic_appender<Char>(buf), s); |
2230 | 0 | size = buf.count(); |
2231 | 0 | } |
2232 | | |
2233 | 319k | size_t width = 0; |
2234 | 319k | if (specs.width != 0) { |
2235 | 43.6k | width = |
2236 | 43.6k | is_debug ? size : compute_width(basic_string_view<Char>(data, size)); |
2237 | 43.6k | } |
2238 | 319k | return write_padded<Char>( |
2239 | 319k | out, specs, size, width, [=](reserve_iterator<OutputIt> it) { |
2240 | 317k | return is_debug ? write_escaped_string(it, s) |
2241 | 317k | : copy<Char>(data, data + size, it); |
2242 | 317k | }); |
2243 | 319k | } |
2244 | | template <typename Char, typename OutputIt> |
2245 | | FMT_CONSTEXPR auto write(OutputIt out, basic_string_view<Char> s, |
2246 | 0 | const format_specs& specs, locale_ref) -> OutputIt { |
2247 | 0 | return write<Char>(out, s, specs); |
2248 | 0 | } |
2249 | | template <typename Char, typename OutputIt> |
2250 | | FMT_CONSTEXPR auto write(OutputIt out, const Char* s, const format_specs& specs, |
2251 | 0 | locale_ref) -> OutputIt { |
2252 | 0 | if (specs.type() == presentation_type::pointer) |
2253 | 0 | return write_ptr<Char>(out, bit_cast<uintptr_t>(s), &specs); |
2254 | 0 | if (!s) report_error("string pointer is null"); |
2255 | 0 | return write<Char>(out, basic_string_view<Char>(s), specs, {}); |
2256 | 0 | } |
2257 | | |
2258 | | template <typename Char, typename OutputIt, typename T, |
2259 | | FMT_ENABLE_IF(is_integral<T>::value && |
2260 | | !std::is_same<T, bool>::value && |
2261 | | !std::is_same<T, Char>::value)> |
2262 | 164k | FMT_CONSTEXPR auto write(OutputIt out, T value) -> OutputIt { |
2263 | 164k | auto abs_value = static_cast<uint32_or_64_or_128_t<T>>(value); |
2264 | 164k | bool negative = is_negative(value); |
2265 | | // Don't do -abs_value since it trips unsigned-integer-overflow sanitizer. |
2266 | 164k | if (negative) abs_value = ~abs_value + 1; |
2267 | 164k | int num_digits = count_digits(abs_value); |
2268 | 164k | auto size = (negative ? 1 : 0) + static_cast<size_t>(num_digits); |
2269 | 164k | if (auto ptr = to_pointer<Char>(out, size)) { |
2270 | 163k | if (negative) *ptr++ = static_cast<Char>('-'); |
2271 | 163k | format_decimal<Char>(ptr, abs_value, num_digits); |
2272 | 163k | return out; |
2273 | 163k | } |
2274 | 573 | if (negative) *out++ = static_cast<Char>('-'); |
2275 | 573 | return format_decimal<Char>(out, abs_value, num_digits); |
2276 | 164k | } _ZN3fmt3v116detail5writeIcNS0_14basic_appenderIcEEiTnNSt3__19enable_ifIXaaaasr11is_integralIT1_EE5valuentsr3std7is_sameIS7_bEE5valuentsr3std7is_sameIS7_T_EE5valueEiE4typeELi0EEET0_SB_S7_ Line | Count | Source | 2262 | 14.9k | FMT_CONSTEXPR auto write(OutputIt out, T value) -> OutputIt { | 2263 | 14.9k | auto abs_value = static_cast<uint32_or_64_or_128_t<T>>(value); | 2264 | 14.9k | bool negative = is_negative(value); | 2265 | | // Don't do -abs_value since it trips unsigned-integer-overflow sanitizer. | 2266 | 14.9k | if (negative) abs_value = ~abs_value + 1; | 2267 | 14.9k | int num_digits = count_digits(abs_value); | 2268 | 14.9k | auto size = (negative ? 1 : 0) + static_cast<size_t>(num_digits); | 2269 | 14.9k | if (auto ptr = to_pointer<Char>(out, size)) { | 2270 | 14.7k | if (negative) *ptr++ = static_cast<Char>('-'); | 2271 | 14.7k | format_decimal<Char>(ptr, abs_value, num_digits); | 2272 | 14.7k | return out; | 2273 | 14.7k | } | 2274 | 133 | if (negative) *out++ = static_cast<Char>('-'); | 2275 | 133 | return format_decimal<Char>(out, abs_value, num_digits); | 2276 | 14.9k | } |
_ZN3fmt3v116detail5writeIcNS0_14basic_appenderIcEEjTnNSt3__19enable_ifIXaaaasr11is_integralIT1_EE5valuentsr3std7is_sameIS7_bEE5valuentsr3std7is_sameIS7_T_EE5valueEiE4typeELi0EEET0_SB_S7_ Line | Count | Source | 2262 | 73.9k | FMT_CONSTEXPR auto write(OutputIt out, T value) -> OutputIt { | 2263 | 73.9k | auto abs_value = static_cast<uint32_or_64_or_128_t<T>>(value); | 2264 | 73.9k | bool negative = is_negative(value); | 2265 | | // Don't do -abs_value since it trips unsigned-integer-overflow sanitizer. | 2266 | 73.9k | if (negative) abs_value = ~abs_value + 1; | 2267 | 73.9k | int num_digits = count_digits(abs_value); | 2268 | 73.9k | auto size = (negative ? 1 : 0) + static_cast<size_t>(num_digits); | 2269 | 73.9k | if (auto ptr = to_pointer<Char>(out, size)) { | 2270 | 73.7k | if (negative) *ptr++ = static_cast<Char>('-'); | 2271 | 73.7k | format_decimal<Char>(ptr, abs_value, num_digits); | 2272 | 73.7k | return out; | 2273 | 73.7k | } | 2274 | 118 | if (negative) *out++ = static_cast<Char>('-'); | 2275 | 118 | return format_decimal<Char>(out, abs_value, num_digits); | 2276 | 73.9k | } |
_ZN3fmt3v116detail5writeIcNS0_14basic_appenderIcEExTnNSt3__19enable_ifIXaaaasr11is_integralIT1_EE5valuentsr3std7is_sameIS7_bEE5valuentsr3std7is_sameIS7_T_EE5valueEiE4typeELi0EEET0_SB_S7_ Line | Count | Source | 2262 | 6.11k | FMT_CONSTEXPR auto write(OutputIt out, T value) -> OutputIt { | 2263 | 6.11k | auto abs_value = static_cast<uint32_or_64_or_128_t<T>>(value); | 2264 | 6.11k | bool negative = is_negative(value); | 2265 | | // Don't do -abs_value since it trips unsigned-integer-overflow sanitizer. | 2266 | 6.11k | if (negative) abs_value = ~abs_value + 1; | 2267 | 6.11k | int num_digits = count_digits(abs_value); | 2268 | 6.11k | auto size = (negative ? 1 : 0) + static_cast<size_t>(num_digits); | 2269 | 6.11k | if (auto ptr = to_pointer<Char>(out, size)) { | 2270 | 5.96k | if (negative) *ptr++ = static_cast<Char>('-'); | 2271 | 5.96k | format_decimal<Char>(ptr, abs_value, num_digits); | 2272 | 5.96k | return out; | 2273 | 5.96k | } | 2274 | 155 | if (negative) *out++ = static_cast<Char>('-'); | 2275 | 155 | return format_decimal<Char>(out, abs_value, num_digits); | 2276 | 6.11k | } |
_ZN3fmt3v116detail5writeIcNS0_14basic_appenderIcEEyTnNSt3__19enable_ifIXaaaasr11is_integralIT1_EE5valuentsr3std7is_sameIS7_bEE5valuentsr3std7is_sameIS7_T_EE5valueEiE4typeELi0EEET0_SB_S7_ Line | Count | Source | 2262 | 4.70k | FMT_CONSTEXPR auto write(OutputIt out, T value) -> OutputIt { | 2263 | 4.70k | auto abs_value = static_cast<uint32_or_64_or_128_t<T>>(value); | 2264 | 4.70k | bool negative = is_negative(value); | 2265 | | // Don't do -abs_value since it trips unsigned-integer-overflow sanitizer. | 2266 | 4.70k | if (negative) abs_value = ~abs_value + 1; | 2267 | 4.70k | int num_digits = count_digits(abs_value); | 2268 | 4.70k | auto size = (negative ? 1 : 0) + static_cast<size_t>(num_digits); | 2269 | 4.70k | if (auto ptr = to_pointer<Char>(out, size)) { | 2270 | 4.53k | if (negative) *ptr++ = static_cast<Char>('-'); | 2271 | 4.53k | format_decimal<Char>(ptr, abs_value, num_digits); | 2272 | 4.53k | return out; | 2273 | 4.53k | } | 2274 | 167 | if (negative) *out++ = static_cast<Char>('-'); | 2275 | 167 | return format_decimal<Char>(out, abs_value, num_digits); | 2276 | 4.70k | } |
Unexecuted instantiation: _ZN3fmt3v116detail5writeIcNS0_14basic_appenderIcEEnTnNSt3__19enable_ifIXaaaasr11is_integralIT1_EE5valuentsr3std7is_sameIS7_bEE5valuentsr3std7is_sameIS7_T_EE5valueEiE4typeELi0EEET0_SB_S7_ Unexecuted instantiation: _ZN3fmt3v116detail5writeIcNS0_14basic_appenderIcEEoTnNSt3__19enable_ifIXaaaasr11is_integralIT1_EE5valuentsr3std7is_sameIS7_bEE5valuentsr3std7is_sameIS7_T_EE5valueEiE4typeELi0EEET0_SB_S7_ _ZN3fmt3v116detail5writeIcNS0_14basic_appenderIcEElTnNSt3__19enable_ifIXaaaasr11is_integralIT1_EE5valuentsr3std7is_sameIS7_bEE5valuentsr3std7is_sameIS7_T_EE5valueEiE4typeELi0EEET0_SB_S7_ Line | Count | Source | 2262 | 8.64k | FMT_CONSTEXPR auto write(OutputIt out, T value) -> OutputIt { | 2263 | 8.64k | auto abs_value = static_cast<uint32_or_64_or_128_t<T>>(value); | 2264 | 8.64k | bool negative = is_negative(value); | 2265 | | // Don't do -abs_value since it trips unsigned-integer-overflow sanitizer. | 2266 | 8.64k | if (negative) abs_value = ~abs_value + 1; | 2267 | 8.64k | int num_digits = count_digits(abs_value); | 2268 | 8.64k | auto size = (negative ? 1 : 0) + static_cast<size_t>(num_digits); | 2269 | 8.64k | if (auto ptr = to_pointer<Char>(out, size)) { | 2270 | 8.64k | if (negative) *ptr++ = static_cast<Char>('-'); | 2271 | 8.64k | format_decimal<Char>(ptr, abs_value, num_digits); | 2272 | 8.64k | return out; | 2273 | 8.64k | } | 2274 | 0 | if (negative) *out++ = static_cast<Char>('-'); | 2275 | 0 | return format_decimal<Char>(out, abs_value, num_digits); | 2276 | 8.64k | } |
_ZN3fmt3v116detail5writeIcNS0_14basic_appenderIcEEaTnNSt3__19enable_ifIXaaaasr11is_integralIT1_EE5valuentsr3std7is_sameIS7_bEE5valuentsr3std7is_sameIS7_T_EE5valueEiE4typeELi0EEET0_SB_S7_ Line | Count | Source | 2262 | 8.32k | FMT_CONSTEXPR auto write(OutputIt out, T value) -> OutputIt { | 2263 | 8.32k | auto abs_value = static_cast<uint32_or_64_or_128_t<T>>(value); | 2264 | 8.32k | bool negative = is_negative(value); | 2265 | | // Don't do -abs_value since it trips unsigned-integer-overflow sanitizer. | 2266 | 8.32k | if (negative) abs_value = ~abs_value + 1; | 2267 | 8.32k | int num_digits = count_digits(abs_value); | 2268 | 8.32k | auto size = (negative ? 1 : 0) + static_cast<size_t>(num_digits); | 2269 | 8.32k | if (auto ptr = to_pointer<Char>(out, size)) { | 2270 | 8.32k | if (negative) *ptr++ = static_cast<Char>('-'); | 2271 | 8.32k | format_decimal<Char>(ptr, abs_value, num_digits); | 2272 | 8.32k | return out; | 2273 | 8.32k | } | 2274 | 0 | if (negative) *out++ = static_cast<Char>('-'); | 2275 | 0 | return format_decimal<Char>(out, abs_value, num_digits); | 2276 | 8.32k | } |
_ZN3fmt3v116detail5writeIcNS0_14basic_appenderIcEEhTnNSt3__19enable_ifIXaaaasr11is_integralIT1_EE5valuentsr3std7is_sameIS7_bEE5valuentsr3std7is_sameIS7_T_EE5valueEiE4typeELi0EEET0_SB_S7_ Line | Count | Source | 2262 | 7.75k | FMT_CONSTEXPR auto write(OutputIt out, T value) -> OutputIt { | 2263 | 7.75k | auto abs_value = static_cast<uint32_or_64_or_128_t<T>>(value); | 2264 | 7.75k | bool negative = is_negative(value); | 2265 | | // Don't do -abs_value since it trips unsigned-integer-overflow sanitizer. | 2266 | 7.75k | if (negative) abs_value = ~abs_value + 1; | 2267 | 7.75k | int num_digits = count_digits(abs_value); | 2268 | 7.75k | auto size = (negative ? 1 : 0) + static_cast<size_t>(num_digits); | 2269 | 7.75k | if (auto ptr = to_pointer<Char>(out, size)) { | 2270 | 7.75k | if (negative) *ptr++ = static_cast<Char>('-'); | 2271 | 7.75k | format_decimal<Char>(ptr, abs_value, num_digits); | 2272 | 7.75k | return out; | 2273 | 7.75k | } | 2274 | 0 | if (negative) *out++ = static_cast<Char>('-'); | 2275 | 0 | return format_decimal<Char>(out, abs_value, num_digits); | 2276 | 7.75k | } |
_ZN3fmt3v116detail5writeIcNS0_14basic_appenderIcEEsTnNSt3__19enable_ifIXaaaasr11is_integralIT1_EE5valuentsr3std7is_sameIS7_bEE5valuentsr3std7is_sameIS7_T_EE5valueEiE4typeELi0EEET0_SB_S7_ Line | Count | Source | 2262 | 9.07k | FMT_CONSTEXPR auto write(OutputIt out, T value) -> OutputIt { | 2263 | 9.07k | auto abs_value = static_cast<uint32_or_64_or_128_t<T>>(value); | 2264 | 9.07k | bool negative = is_negative(value); | 2265 | | // Don't do -abs_value since it trips unsigned-integer-overflow sanitizer. | 2266 | 9.07k | if (negative) abs_value = ~abs_value + 1; | 2267 | 9.07k | int num_digits = count_digits(abs_value); | 2268 | 9.07k | auto size = (negative ? 1 : 0) + static_cast<size_t>(num_digits); | 2269 | 9.07k | if (auto ptr = to_pointer<Char>(out, size)) { | 2270 | 9.07k | if (negative) *ptr++ = static_cast<Char>('-'); | 2271 | 9.07k | format_decimal<Char>(ptr, abs_value, num_digits); | 2272 | 9.07k | return out; | 2273 | 9.07k | } | 2274 | 0 | if (negative) *out++ = static_cast<Char>('-'); | 2275 | 0 | return format_decimal<Char>(out, abs_value, num_digits); | 2276 | 9.07k | } |
_ZN3fmt3v116detail5writeIcNS0_14basic_appenderIcEEtTnNSt3__19enable_ifIXaaaasr11is_integralIT1_EE5valuentsr3std7is_sameIS7_bEE5valuentsr3std7is_sameIS7_T_EE5valueEiE4typeELi0EEET0_SB_S7_ Line | Count | Source | 2262 | 7.66k | FMT_CONSTEXPR auto write(OutputIt out, T value) -> OutputIt { | 2263 | 7.66k | auto abs_value = static_cast<uint32_or_64_or_128_t<T>>(value); | 2264 | 7.66k | bool negative = is_negative(value); | 2265 | | // Don't do -abs_value since it trips unsigned-integer-overflow sanitizer. | 2266 | 7.66k | if (negative) abs_value = ~abs_value + 1; | 2267 | 7.66k | int num_digits = count_digits(abs_value); | 2268 | 7.66k | auto size = (negative ? 1 : 0) + static_cast<size_t>(num_digits); | 2269 | 7.66k | if (auto ptr = to_pointer<Char>(out, size)) { | 2270 | 7.66k | if (negative) *ptr++ = static_cast<Char>('-'); | 2271 | 7.66k | format_decimal<Char>(ptr, abs_value, num_digits); | 2272 | 7.66k | return out; | 2273 | 7.66k | } | 2274 | 0 | if (negative) *out++ = static_cast<Char>('-'); | 2275 | 0 | return format_decimal<Char>(out, abs_value, num_digits); | 2276 | 7.66k | } |
_ZN3fmt3v116detail5writeIcNS0_14basic_appenderIcEEmTnNSt3__19enable_ifIXaaaasr11is_integralIT1_EE5valuentsr3std7is_sameIS7_bEE5valuentsr3std7is_sameIS7_T_EE5valueEiE4typeELi0EEET0_SB_S7_ Line | Count | Source | 2262 | 23.4k | FMT_CONSTEXPR auto write(OutputIt out, T value) -> OutputIt { | 2263 | 23.4k | auto abs_value = static_cast<uint32_or_64_or_128_t<T>>(value); | 2264 | 23.4k | bool negative = is_negative(value); | 2265 | | // Don't do -abs_value since it trips unsigned-integer-overflow sanitizer. | 2266 | 23.4k | if (negative) abs_value = ~abs_value + 1; | 2267 | 23.4k | int num_digits = count_digits(abs_value); | 2268 | 23.4k | auto size = (negative ? 1 : 0) + static_cast<size_t>(num_digits); | 2269 | 23.4k | if (auto ptr = to_pointer<Char>(out, size)) { | 2270 | 23.4k | if (negative) *ptr++ = static_cast<Char>('-'); | 2271 | 23.4k | format_decimal<Char>(ptr, abs_value, num_digits); | 2272 | 23.4k | return out; | 2273 | 23.4k | } | 2274 | 0 | if (negative) *out++ = static_cast<Char>('-'); | 2275 | 0 | return format_decimal<Char>(out, abs_value, num_digits); | 2276 | 23.4k | } |
|
2277 | | |
2278 | | template <typename Char> |
2279 | | FMT_CONSTEXPR auto parse_align(const Char* begin, const Char* end, |
2280 | 247k | format_specs& specs) -> const Char* { |
2281 | 247k | FMT_ASSERT(begin != end, ""); |
2282 | 247k | auto alignment = align::none; |
2283 | 247k | auto p = begin + code_point_length(begin); |
2284 | 247k | if (end - p <= 0) p = begin; |
2285 | 492k | for (;;) { |
2286 | 492k | switch (to_ascii(*p)) { |
2287 | 4.43k | case '<': alignment = align::left; break; |
2288 | 1.27k | case '>': alignment = align::right; break; |
2289 | 1.02k | case '^': alignment = align::center; break; |
2290 | 492k | } |
2291 | 492k | if (alignment != align::none) { |
2292 | 6.73k | if (p != begin) { |
2293 | 1.35k | auto c = *begin; |
2294 | 1.35k | if (c == '}') return begin; |
2295 | 1.35k | if (c == '{') { |
2296 | 2 | report_error("invalid fill character '{'"); |
2297 | 2 | return begin; |
2298 | 2 | } |
2299 | 1.34k | specs.set_fill(basic_string_view<Char>(begin, to_unsigned(p - begin))); |
2300 | 1.34k | begin = p + 1; |
2301 | 5.38k | } else { |
2302 | 5.38k | ++begin; |
2303 | 5.38k | } |
2304 | 6.73k | break; |
2305 | 486k | } else if (p == begin) { |
2306 | 240k | break; |
2307 | 240k | } |
2308 | 245k | p = begin; |
2309 | 245k | } |
2310 | 247k | specs.set_align(alignment); |
2311 | 247k | return begin; |
2312 | 247k | } |
2313 | | |
2314 | | template <typename Char, typename OutputIt> |
2315 | | FMT_CONSTEXPR20 auto write_nonfinite(OutputIt out, bool isnan, |
2316 | 33.4k | format_specs specs, sign s) -> OutputIt { |
2317 | 33.4k | auto str = |
2318 | 33.4k | isnan ? (specs.upper() ? "NAN" : "nan") : (specs.upper() ? "INF" : "inf"); |
2319 | 33.4k | constexpr size_t str_size = 3; |
2320 | 33.4k | auto size = str_size + (s != sign::none ? 1 : 0); |
2321 | | // Replace '0'-padding with space for non-finite values. |
2322 | 33.4k | const bool is_zero_fill = |
2323 | 33.4k | specs.fill_size() == 1 && specs.fill_unit<Char>() == '0'; |
2324 | 33.4k | if (is_zero_fill) specs.set_fill(' '); |
2325 | 33.4k | return write_padded<Char>(out, specs, size, |
2326 | 33.4k | [=](reserve_iterator<OutputIt> it) { |
2327 | 33.3k | if (s != sign::none) |
2328 | 22.0k | *it++ = detail::getsign<Char>(s); |
2329 | 33.3k | return copy<Char>(str, str + str_size, it); |
2330 | 33.3k | }); |
2331 | 33.4k | } |
2332 | | |
2333 | | // A decimal floating-point number significand * pow(10, exp). |
2334 | | struct big_decimal_fp { |
2335 | | const char* significand; |
2336 | | int significand_size; |
2337 | | int exponent; |
2338 | | }; |
2339 | | |
2340 | 276k | constexpr auto get_significand_size(const big_decimal_fp& f) -> int { |
2341 | 276k | return f.significand_size; |
2342 | 276k | } |
2343 | | template <typename T> |
2344 | 68.1k | inline auto get_significand_size(const dragonbox::decimal_fp<T>& f) -> int { |
2345 | 68.1k | return count_digits(f.significand); |
2346 | 68.1k | } int fmt::v11::detail::get_significand_size<float>(fmt::v11::detail::dragonbox::decimal_fp<float> const&) Line | Count | Source | 2344 | 32.2k | inline auto get_significand_size(const dragonbox::decimal_fp<T>& f) -> int { | 2345 | 32.2k | return count_digits(f.significand); | 2346 | 32.2k | } |
int fmt::v11::detail::get_significand_size<double>(fmt::v11::detail::dragonbox::decimal_fp<double> const&) Line | Count | Source | 2344 | 35.8k | inline auto get_significand_size(const dragonbox::decimal_fp<T>& f) -> int { | 2345 | 35.8k | return count_digits(f.significand); | 2346 | 35.8k | } |
|
2347 | | |
2348 | | template <typename Char, typename OutputIt> |
2349 | | constexpr auto write_significand(OutputIt out, const char* significand, |
2350 | 158k | int significand_size) -> OutputIt { |
2351 | 158k | return copy<Char>(significand, significand + significand_size, out); |
2352 | 158k | } |
2353 | | template <typename Char, typename OutputIt, typename UInt> |
2354 | | inline auto write_significand(OutputIt out, UInt significand, |
2355 | 26.6k | int significand_size) -> OutputIt { |
2356 | 26.6k | return format_decimal<Char>(out, significand, significand_size); |
2357 | 26.6k | } fmt::v11::basic_appender<char> fmt::v11::detail::write_significand<char, fmt::v11::basic_appender<char>, unsigned int>(fmt::v11::basic_appender<char>, unsigned int, int) Line | Count | Source | 2355 | 13.5k | int significand_size) -> OutputIt { | 2356 | 13.5k | return format_decimal<Char>(out, significand, significand_size); | 2357 | 13.5k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_significand<char, fmt::v11::basic_appender<char>, unsigned long>(fmt::v11::basic_appender<char>, unsigned long, int) Line | Count | Source | 2355 | 13.0k | int significand_size) -> OutputIt { | 2356 | 13.0k | return format_decimal<Char>(out, significand, significand_size); | 2357 | 13.0k | } |
|
2358 | | template <typename Char, typename OutputIt, typename T, typename Grouping> |
2359 | | FMT_CONSTEXPR20 auto write_significand(OutputIt out, T significand, |
2360 | | int significand_size, int exponent, |
2361 | 54.1k | const Grouping& grouping) -> OutputIt { |
2362 | 54.1k | if (!grouping.has_separator()) { |
2363 | 54.1k | out = write_significand<Char>(out, significand, significand_size); |
2364 | 54.1k | return detail::fill_n(out, exponent, static_cast<Char>('0')); |
2365 | 54.1k | } |
2366 | 0 | auto buffer = memory_buffer(); |
2367 | 0 | write_significand<char>(appender(buffer), significand, significand_size); |
2368 | 0 | detail::fill_n(appender(buffer), exponent, '0'); |
2369 | 0 | return grouping.apply(out, string_view(buffer.data(), buffer.size())); |
2370 | 54.1k | } fmt::v11::basic_appender<char> fmt::v11::detail::write_significand<char, fmt::v11::basic_appender<char>, unsigned int, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, unsigned int, int, int, fmt::v11::detail::digit_grouping<char> const&) Line | Count | Source | 2361 | 8.52k | const Grouping& grouping) -> OutputIt { | 2362 | 8.52k | if (!grouping.has_separator()) { | 2363 | 8.52k | out = write_significand<Char>(out, significand, significand_size); | 2364 | 8.52k | return detail::fill_n(out, exponent, static_cast<Char>('0')); | 2365 | 8.52k | } | 2366 | 0 | auto buffer = memory_buffer(); | 2367 | 0 | write_significand<char>(appender(buffer), significand, significand_size); | 2368 | 0 | detail::fill_n(appender(buffer), exponent, '0'); | 2369 | 0 | return grouping.apply(out, string_view(buffer.data(), buffer.size())); | 2370 | 8.52k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_significand<char, fmt::v11::basic_appender<char>, unsigned long, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, unsigned long, int, int, fmt::v11::detail::digit_grouping<char> const&) Line | Count | Source | 2361 | 8.02k | const Grouping& grouping) -> OutputIt { | 2362 | 8.02k | if (!grouping.has_separator()) { | 2363 | 8.02k | out = write_significand<Char>(out, significand, significand_size); | 2364 | 8.02k | return detail::fill_n(out, exponent, static_cast<Char>('0')); | 2365 | 8.02k | } | 2366 | 0 | auto buffer = memory_buffer(); | 2367 | 0 | write_significand<char>(appender(buffer), significand, significand_size); | 2368 | 0 | detail::fill_n(appender(buffer), exponent, '0'); | 2369 | 0 | return grouping.apply(out, string_view(buffer.data(), buffer.size())); | 2370 | 8.02k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_significand<char, fmt::v11::basic_appender<char>, char const*, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, char const*, int, int, fmt::v11::detail::digit_grouping<char> const&) Line | Count | Source | 2361 | 37.6k | const Grouping& grouping) -> OutputIt { | 2362 | 37.6k | if (!grouping.has_separator()) { | 2363 | 37.6k | out = write_significand<Char>(out, significand, significand_size); | 2364 | 37.6k | return detail::fill_n(out, exponent, static_cast<Char>('0')); | 2365 | 37.6k | } | 2366 | 0 | auto buffer = memory_buffer(); | 2367 | 0 | write_significand<char>(appender(buffer), significand, significand_size); | 2368 | 0 | detail::fill_n(appender(buffer), exponent, '0'); | 2369 | 0 | return grouping.apply(out, string_view(buffer.data(), buffer.size())); | 2370 | 37.6k | } |
Unexecuted instantiation: fmt::v11::basic_appender<char> fmt::v11::detail::write_significand<char, fmt::v11::basic_appender<char>, char const*, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, char const*, int, int, fmt::v11::detail::fallback_digit_grouping<char> const&) Unexecuted instantiation: fmt::v11::basic_appender<char> fmt::v11::detail::write_significand<char, fmt::v11::basic_appender<char>, unsigned int, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, unsigned int, int, int, fmt::v11::detail::fallback_digit_grouping<char> const&) Unexecuted instantiation: fmt::v11::basic_appender<char> fmt::v11::detail::write_significand<char, fmt::v11::basic_appender<char>, unsigned long, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, unsigned long, int, int, fmt::v11::detail::fallback_digit_grouping<char> const&) |
2371 | | |
2372 | | template <typename Char, typename UInt, |
2373 | | FMT_ENABLE_IF(std::is_integral<UInt>::value)> |
2374 | | inline auto write_significand(Char* out, UInt significand, int significand_size, |
2375 | 40.6k | int integral_size, Char decimal_point) -> Char* { |
2376 | 40.6k | if (!decimal_point) return format_decimal(out, significand, significand_size); |
2377 | 37.1k | out += significand_size + 1; |
2378 | 37.1k | Char* end = out; |
2379 | 37.1k | int floating_size = significand_size - integral_size; |
2380 | 188k | for (int i = floating_size / 2; i > 0; --i) { |
2381 | 151k | out -= 2; |
2382 | 151k | write2digits(out, static_cast<std::size_t>(significand % 100)); |
2383 | 151k | significand /= 100; |
2384 | 151k | } |
2385 | 37.1k | if (floating_size % 2 != 0) { |
2386 | 21.5k | *--out = static_cast<Char>('0' + significand % 10); |
2387 | 21.5k | significand /= 10; |
2388 | 21.5k | } |
2389 | 37.1k | *--out = decimal_point; |
2390 | 37.1k | format_decimal(out - integral_size, significand, integral_size); |
2391 | 37.1k | return end; |
2392 | 40.6k | } _ZN3fmt3v116detail17write_significandIcjTnNSt3__19enable_ifIXsr3std11is_integralIT0_EE5valueEiE4typeELi0EEEPT_S9_S5_iiS8_ Line | Count | Source | 2375 | 18.3k | int integral_size, Char decimal_point) -> Char* { | 2376 | 18.3k | if (!decimal_point) return format_decimal(out, significand, significand_size); | 2377 | 16.7k | out += significand_size + 1; | 2378 | 16.7k | Char* end = out; | 2379 | 16.7k | int floating_size = significand_size - integral_size; | 2380 | 52.5k | for (int i = floating_size / 2; i > 0; --i) { | 2381 | 35.8k | out -= 2; | 2382 | 35.8k | write2digits(out, static_cast<std::size_t>(significand % 100)); | 2383 | 35.8k | significand /= 100; | 2384 | 35.8k | } | 2385 | 16.7k | if (floating_size % 2 != 0) { | 2386 | 10.8k | *--out = static_cast<Char>('0' + significand % 10); | 2387 | 10.8k | significand /= 10; | 2388 | 10.8k | } | 2389 | 16.7k | *--out = decimal_point; | 2390 | 16.7k | format_decimal(out - integral_size, significand, integral_size); | 2391 | 16.7k | return end; | 2392 | 18.3k | } |
_ZN3fmt3v116detail17write_significandIcmTnNSt3__19enable_ifIXsr3std11is_integralIT0_EE5valueEiE4typeELi0EEEPT_S9_S5_iiS8_ Line | Count | Source | 2375 | 22.3k | int integral_size, Char decimal_point) -> Char* { | 2376 | 22.3k | if (!decimal_point) return format_decimal(out, significand, significand_size); | 2377 | 20.4k | out += significand_size + 1; | 2378 | 20.4k | Char* end = out; | 2379 | 20.4k | int floating_size = significand_size - integral_size; | 2380 | 136k | for (int i = floating_size / 2; i > 0; --i) { | 2381 | 115k | out -= 2; | 2382 | 115k | write2digits(out, static_cast<std::size_t>(significand % 100)); | 2383 | 115k | significand /= 100; | 2384 | 115k | } | 2385 | 20.4k | if (floating_size % 2 != 0) { | 2386 | 10.7k | *--out = static_cast<Char>('0' + significand % 10); | 2387 | 10.7k | significand /= 10; | 2388 | 10.7k | } | 2389 | 20.4k | *--out = decimal_point; | 2390 | 20.4k | format_decimal(out - integral_size, significand, integral_size); | 2391 | 20.4k | return end; | 2392 | 22.3k | } |
|
2393 | | |
2394 | | template <typename OutputIt, typename UInt, typename Char, |
2395 | | FMT_ENABLE_IF(!std::is_pointer<remove_cvref_t<OutputIt>>::value)> |
2396 | | inline auto write_significand(OutputIt out, UInt significand, |
2397 | | int significand_size, int integral_size, |
2398 | 40.6k | Char decimal_point) -> OutputIt { |
2399 | | // Buffer is large enough to hold digits (digits10 + 1) and a decimal point. |
2400 | 40.6k | Char buffer[digits10<UInt>() + 2]; |
2401 | 40.6k | auto end = write_significand(buffer, significand, significand_size, |
2402 | 40.6k | integral_size, decimal_point); |
2403 | 40.6k | return detail::copy_noinline<Char>(buffer, end, out); |
2404 | 40.6k | } _ZN3fmt3v116detail17write_significandINS0_14basic_appenderIcEEjcTnNSt3__19enable_ifIXntsr3std10is_pointerINS5_9remove_cvINS5_16remove_referenceIT_E4typeEE4typeEEE5valueEiE4typeELi0EEES9_S9_T0_iiT1_ Line | Count | Source | 2398 | 18.3k | Char decimal_point) -> OutputIt { | 2399 | | // Buffer is large enough to hold digits (digits10 + 1) and a decimal point. | 2400 | 18.3k | Char buffer[digits10<UInt>() + 2]; | 2401 | 18.3k | auto end = write_significand(buffer, significand, significand_size, | 2402 | 18.3k | integral_size, decimal_point); | 2403 | 18.3k | return detail::copy_noinline<Char>(buffer, end, out); | 2404 | 18.3k | } |
_ZN3fmt3v116detail17write_significandINS0_14basic_appenderIcEEmcTnNSt3__19enable_ifIXntsr3std10is_pointerINS5_9remove_cvINS5_16remove_referenceIT_E4typeEE4typeEEE5valueEiE4typeELi0EEES9_S9_T0_iiT1_ Line | Count | Source | 2398 | 22.3k | Char decimal_point) -> OutputIt { | 2399 | | // Buffer is large enough to hold digits (digits10 + 1) and a decimal point. | 2400 | 22.3k | Char buffer[digits10<UInt>() + 2]; | 2401 | 22.3k | auto end = write_significand(buffer, significand, significand_size, | 2402 | 22.3k | integral_size, decimal_point); | 2403 | 22.3k | return detail::copy_noinline<Char>(buffer, end, out); | 2404 | 22.3k | } |
|
2405 | | |
2406 | | template <typename OutputIt, typename Char> |
2407 | | FMT_CONSTEXPR auto write_significand(OutputIt out, const char* significand, |
2408 | | int significand_size, int integral_size, |
2409 | 110k | Char decimal_point) -> OutputIt { |
2410 | 110k | out = detail::copy_noinline<Char>(significand, significand + integral_size, |
2411 | 110k | out); |
2412 | 110k | if (!decimal_point) return out; |
2413 | 104k | *out++ = decimal_point; |
2414 | 104k | return detail::copy_noinline<Char>(significand + integral_size, |
2415 | 104k | significand + significand_size, out); |
2416 | 110k | } |
2417 | | |
2418 | | template <typename OutputIt, typename Char, typename T, typename Grouping> |
2419 | | FMT_CONSTEXPR20 auto write_significand(OutputIt out, T significand, |
2420 | | int significand_size, int integral_size, |
2421 | | Char decimal_point, |
2422 | 55.0k | const Grouping& grouping) -> OutputIt { |
2423 | 55.0k | if (!grouping.has_separator()) { |
2424 | 55.0k | return write_significand(out, significand, significand_size, integral_size, |
2425 | 55.0k | decimal_point); |
2426 | 55.0k | } |
2427 | 0 | auto buffer = basic_memory_buffer<Char>(); |
2428 | 0 | write_significand(basic_appender<Char>(buffer), significand, significand_size, |
2429 | 0 | integral_size, decimal_point); |
2430 | 0 | grouping.apply( |
2431 | 0 | out, basic_string_view<Char>(buffer.data(), to_unsigned(integral_size))); |
2432 | 0 | return detail::copy_noinline<Char>(buffer.data() + integral_size, |
2433 | 0 | buffer.end(), out); |
2434 | 55.0k | } fmt::v11::basic_appender<char> fmt::v11::detail::write_significand<fmt::v11::basic_appender<char>, char, unsigned int, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, unsigned int, int, int, char, fmt::v11::detail::digit_grouping<char> const&) Line | Count | Source | 2422 | 5.90k | const Grouping& grouping) -> OutputIt { | 2423 | 5.90k | if (!grouping.has_separator()) { | 2424 | 5.90k | return write_significand(out, significand, significand_size, integral_size, | 2425 | 5.90k | decimal_point); | 2426 | 5.90k | } | 2427 | 0 | auto buffer = basic_memory_buffer<Char>(); | 2428 | 0 | write_significand(basic_appender<Char>(buffer), significand, significand_size, | 2429 | 0 | integral_size, decimal_point); | 2430 | 0 | grouping.apply( | 2431 | 0 | out, basic_string_view<Char>(buffer.data(), to_unsigned(integral_size))); | 2432 | 0 | return detail::copy_noinline<Char>(buffer.data() + integral_size, | 2433 | 0 | buffer.end(), out); | 2434 | 5.90k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_significand<fmt::v11::basic_appender<char>, char, unsigned long, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, unsigned long, int, int, char, fmt::v11::detail::digit_grouping<char> const&) Line | Count | Source | 2422 | 5.54k | const Grouping& grouping) -> OutputIt { | 2423 | 5.54k | if (!grouping.has_separator()) { | 2424 | 5.54k | return write_significand(out, significand, significand_size, integral_size, | 2425 | 5.54k | decimal_point); | 2426 | 5.54k | } | 2427 | 0 | auto buffer = basic_memory_buffer<Char>(); | 2428 | 0 | write_significand(basic_appender<Char>(buffer), significand, significand_size, | 2429 | 0 | integral_size, decimal_point); | 2430 | 0 | grouping.apply( | 2431 | 0 | out, basic_string_view<Char>(buffer.data(), to_unsigned(integral_size))); | 2432 | 0 | return detail::copy_noinline<Char>(buffer.data() + integral_size, | 2433 | 0 | buffer.end(), out); | 2434 | 5.54k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_significand<fmt::v11::basic_appender<char>, char, char const*, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, char const*, int, int, char, fmt::v11::detail::digit_grouping<char> const&) Line | Count | Source | 2422 | 43.5k | const Grouping& grouping) -> OutputIt { | 2423 | 43.5k | if (!grouping.has_separator()) { | 2424 | 43.5k | return write_significand(out, significand, significand_size, integral_size, | 2425 | 43.5k | decimal_point); | 2426 | 43.5k | } | 2427 | 0 | auto buffer = basic_memory_buffer<Char>(); | 2428 | 0 | write_significand(basic_appender<Char>(buffer), significand, significand_size, | 2429 | 0 | integral_size, decimal_point); | 2430 | 0 | grouping.apply( | 2431 | 0 | out, basic_string_view<Char>(buffer.data(), to_unsigned(integral_size))); | 2432 | 0 | return detail::copy_noinline<Char>(buffer.data() + integral_size, | 2433 | 0 | buffer.end(), out); | 2434 | 43.5k | } |
Unexecuted instantiation: fmt::v11::basic_appender<char> fmt::v11::detail::write_significand<fmt::v11::basic_appender<char>, char, char const*, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, char const*, int, int, char, fmt::v11::detail::fallback_digit_grouping<char> const&) Unexecuted instantiation: fmt::v11::basic_appender<char> fmt::v11::detail::write_significand<fmt::v11::basic_appender<char>, char, unsigned int, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, unsigned int, int, int, char, fmt::v11::detail::fallback_digit_grouping<char> const&) Unexecuted instantiation: fmt::v11::basic_appender<char> fmt::v11::detail::write_significand<fmt::v11::basic_appender<char>, char, unsigned long, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, unsigned long, int, int, char, fmt::v11::detail::fallback_digit_grouping<char> const&) |
2435 | | |
2436 | | template <typename Char, typename OutputIt, typename DecimalFP, |
2437 | | typename Grouping = digit_grouping<Char>> |
2438 | | FMT_CONSTEXPR20 auto do_write_float(OutputIt out, const DecimalFP& f, |
2439 | | const format_specs& specs, sign s, |
2440 | 344k | locale_ref loc) -> OutputIt { |
2441 | 344k | auto significand = f.significand; |
2442 | 344k | int significand_size = get_significand_size(f); |
2443 | 344k | const Char zero = static_cast<Char>('0'); |
2444 | 344k | size_t size = to_unsigned(significand_size) + (s != sign::none ? 1 : 0); |
2445 | 344k | using iterator = reserve_iterator<OutputIt>; |
2446 | | |
2447 | 344k | Char decimal_point = specs.localized() ? detail::decimal_point<Char>(loc) |
2448 | 344k | : static_cast<Char>('.'); |
2449 | | |
2450 | 344k | int output_exp = f.exponent + significand_size - 1; |
2451 | 344k | auto use_exp_format = [=]() { |
2452 | 344k | if (specs.type() == presentation_type::exp) return true; |
2453 | 338k | if (specs.type() == presentation_type::fixed) return false; |
2454 | | // Use the fixed notation if the exponent is in [exp_lower, exp_upper), |
2455 | | // e.g. 0.0001 instead of 1e-04. Otherwise use the exponent notation. |
2456 | 153k | const int exp_lower = -4, exp_upper = 16; |
2457 | 153k | return output_exp < exp_lower || |
2458 | 153k | output_exp >= (specs.precision > 0 ? specs.precision : exp_upper); |
2459 | 338k | }; fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda()#1}::operator()() const Line | Count | Source | 2451 | 32.2k | auto use_exp_format = [=]() { | 2452 | 32.2k | if (specs.type() == presentation_type::exp) return true; | 2453 | 32.2k | if (specs.type() == presentation_type::fixed) return false; | 2454 | | // Use the fixed notation if the exponent is in [exp_lower, exp_upper), | 2455 | | // e.g. 0.0001 instead of 1e-04. Otherwise use the exponent notation. | 2456 | 32.2k | const int exp_lower = -4, exp_upper = 16; | 2457 | 32.2k | return output_exp < exp_lower || | 2458 | 32.2k | output_exp >= (specs.precision > 0 ? specs.precision : exp_upper); | 2459 | 32.2k | }; |
fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda()#1}::operator()() const Line | Count | Source | 2451 | 35.8k | auto use_exp_format = [=]() { | 2452 | 35.8k | if (specs.type() == presentation_type::exp) return true; | 2453 | 35.8k | if (specs.type() == presentation_type::fixed) return false; | 2454 | | // Use the fixed notation if the exponent is in [exp_lower, exp_upper), | 2455 | | // e.g. 0.0001 instead of 1e-04. Otherwise use the exponent notation. | 2456 | 35.8k | const int exp_lower = -4, exp_upper = 16; | 2457 | 35.8k | return output_exp < exp_lower || | 2458 | 35.8k | output_exp >= (specs.precision > 0 ? specs.precision : exp_upper); | 2459 | 35.8k | }; |
fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda()#1}::operator()() const Line | Count | Source | 2451 | 276k | auto use_exp_format = [=]() { | 2452 | 276k | if (specs.type() == presentation_type::exp) return true; | 2453 | 270k | if (specs.type() == presentation_type::fixed) return false; | 2454 | | // Use the fixed notation if the exponent is in [exp_lower, exp_upper), | 2455 | | // e.g. 0.0001 instead of 1e-04. Otherwise use the exponent notation. | 2456 | 85.8k | const int exp_lower = -4, exp_upper = 16; | 2457 | 85.8k | return output_exp < exp_lower || | 2458 | 85.8k | output_exp >= (specs.precision > 0 ? specs.precision : exp_upper); | 2459 | 270k | }; |
|
2460 | 344k | if (use_exp_format()) { |
2461 | 97.0k | int num_zeros = 0; |
2462 | 97.0k | if (specs.alt()) { |
2463 | 7.21k | num_zeros = specs.precision - significand_size; |
2464 | 7.21k | if (num_zeros < 0) num_zeros = 0; |
2465 | 7.21k | size += to_unsigned(num_zeros); |
2466 | 89.7k | } else if (significand_size == 1) { |
2467 | 9.40k | decimal_point = Char(); |
2468 | 9.40k | } |
2469 | 97.0k | auto abs_output_exp = output_exp >= 0 ? output_exp : -output_exp; |
2470 | 97.0k | int exp_digits = 2; |
2471 | 97.0k | if (abs_output_exp >= 100) exp_digits = abs_output_exp >= 1000 ? 4 : 3; |
2472 | | |
2473 | 97.0k | size += to_unsigned((decimal_point ? 1 : 0) + 2 + exp_digits); |
2474 | 97.0k | char exp_char = specs.upper() ? 'E' : 'e'; |
2475 | 97.0k | auto write = [=](iterator it) { |
2476 | 96.4k | if (s != sign::none) *it++ = detail::getsign<Char>(s); |
2477 | | // Insert a decimal point after the first digit and add an exponent. |
2478 | 96.4k | it = write_significand(it, significand, significand_size, 1, |
2479 | 96.4k | decimal_point); |
2480 | 96.4k | if (num_zeros > 0) it = detail::fill_n(it, num_zeros, zero); |
2481 | 96.4k | *it++ = static_cast<Char>(exp_char); |
2482 | 96.4k | return write_exponent<Char>(output_exp, it); |
2483 | 96.4k | }; fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#1}::operator()(fmt::v11::basic_appender<char>) const Line | Count | Source | 2475 | 12.4k | auto write = [=](iterator it) { | 2476 | 12.4k | if (s != sign::none) *it++ = detail::getsign<Char>(s); | 2477 | | // Insert a decimal point after the first digit and add an exponent. | 2478 | 12.4k | it = write_significand(it, significand, significand_size, 1, | 2479 | 12.4k | decimal_point); | 2480 | 12.4k | if (num_zeros > 0) it = detail::fill_n(it, num_zeros, zero); | 2481 | 12.4k | *it++ = static_cast<Char>(exp_char); | 2482 | 12.4k | return write_exponent<Char>(output_exp, it); | 2483 | 12.4k | }; |
fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#1}::operator()(fmt::v11::basic_appender<char>) const Line | Count | Source | 2475 | 16.7k | auto write = [=](iterator it) { | 2476 | 16.7k | if (s != sign::none) *it++ = detail::getsign<Char>(s); | 2477 | | // Insert a decimal point after the first digit and add an exponent. | 2478 | 16.7k | it = write_significand(it, significand, significand_size, 1, | 2479 | 16.7k | decimal_point); | 2480 | 16.7k | if (num_zeros > 0) it = detail::fill_n(it, num_zeros, zero); | 2481 | 16.7k | *it++ = static_cast<Char>(exp_char); | 2482 | 16.7k | return write_exponent<Char>(output_exp, it); | 2483 | 16.7k | }; |
fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#1}::operator()(fmt::v11::basic_appender<char>) const Line | Count | Source | 2475 | 67.2k | auto write = [=](iterator it) { | 2476 | 67.2k | if (s != sign::none) *it++ = detail::getsign<Char>(s); | 2477 | | // Insert a decimal point after the first digit and add an exponent. | 2478 | 67.2k | it = write_significand(it, significand, significand_size, 1, | 2479 | 67.2k | decimal_point); | 2480 | 67.2k | if (num_zeros > 0) it = detail::fill_n(it, num_zeros, zero); | 2481 | 67.2k | *it++ = static_cast<Char>(exp_char); | 2482 | 67.2k | return write_exponent<Char>(output_exp, it); | 2483 | 67.2k | }; |
|
2484 | 97.0k | return specs.width > 0 |
2485 | 97.0k | ? write_padded<Char, align::right>(out, specs, size, write) |
2486 | 97.0k | : base_iterator(out, write(reserve(out, size))); |
2487 | 97.0k | } |
2488 | | |
2489 | 247k | int exp = f.exponent + significand_size; |
2490 | 247k | if (f.exponent >= 0) { |
2491 | | // 1234e5 -> 123400000[.0+] |
2492 | 54.6k | size += to_unsigned(f.exponent); |
2493 | 54.6k | int num_zeros = specs.precision - exp; |
2494 | 54.6k | abort_fuzzing_if(num_zeros > 5000); |
2495 | 54.6k | if (specs.alt()) { |
2496 | 4.77k | ++size; |
2497 | 4.77k | if (num_zeros <= 0 && specs.type() != presentation_type::fixed) |
2498 | 2.90k | num_zeros = 0; |
2499 | 4.77k | if (num_zeros > 0) size += to_unsigned(num_zeros); |
2500 | 4.77k | } |
2501 | 54.6k | auto grouping = Grouping(loc, specs.localized()); |
2502 | 54.6k | size += to_unsigned(grouping.count_separators(exp)); |
2503 | 54.6k | return write_padded<Char, align::right>(out, specs, size, [&](iterator it) { |
2504 | 54.1k | if (s != sign::none) *it++ = detail::getsign<Char>(s); |
2505 | 54.1k | it = write_significand<Char>(it, significand, significand_size, |
2506 | 54.1k | f.exponent, grouping); |
2507 | 54.1k | if (!specs.alt()) return it; |
2508 | 4.77k | *it++ = decimal_point; |
2509 | 4.77k | return num_zeros > 0 ? detail::fill_n(it, num_zeros, zero) : it; |
2510 | 54.1k | }); fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#2}::operator()(fmt::v11::basic_appender<char>) const Line | Count | Source | 2503 | 8.52k | return write_padded<Char, align::right>(out, specs, size, [&](iterator it) { | 2504 | 8.52k | if (s != sign::none) *it++ = detail::getsign<Char>(s); | 2505 | 8.52k | it = write_significand<Char>(it, significand, significand_size, | 2506 | 8.52k | f.exponent, grouping); | 2507 | 8.52k | if (!specs.alt()) return it; | 2508 | 724 | *it++ = decimal_point; | 2509 | 724 | return num_zeros > 0 ? detail::fill_n(it, num_zeros, zero) : it; | 2510 | 8.52k | }); |
fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#2}::operator()(fmt::v11::basic_appender<char>) const Line | Count | Source | 2503 | 8.02k | return write_padded<Char, align::right>(out, specs, size, [&](iterator it) { | 2504 | 8.02k | if (s != sign::none) *it++ = detail::getsign<Char>(s); | 2505 | 8.02k | it = write_significand<Char>(it, significand, significand_size, | 2506 | 8.02k | f.exponent, grouping); | 2507 | 8.02k | if (!specs.alt()) return it; | 2508 | 1.09k | *it++ = decimal_point; | 2509 | 1.09k | return num_zeros > 0 ? detail::fill_n(it, num_zeros, zero) : it; | 2510 | 8.02k | }); |
fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#2}::operator()(fmt::v11::basic_appender<char>) const Line | Count | Source | 2503 | 37.6k | return write_padded<Char, align::right>(out, specs, size, [&](iterator it) { | 2504 | 37.6k | if (s != sign::none) *it++ = detail::getsign<Char>(s); | 2505 | 37.6k | it = write_significand<Char>(it, significand, significand_size, | 2506 | 37.6k | f.exponent, grouping); | 2507 | 37.6k | if (!specs.alt()) return it; | 2508 | 2.95k | *it++ = decimal_point; | 2509 | 2.95k | return num_zeros > 0 ? detail::fill_n(it, num_zeros, zero) : it; | 2510 | 37.6k | }); |
|
2511 | 193k | } else if (exp > 0) { |
2512 | | // 1234e-2 -> 12.34[0+] |
2513 | 55.3k | int num_zeros = specs.alt() ? specs.precision - significand_size : 0; |
2514 | 55.3k | size += 1 + static_cast<unsigned>(max_of(num_zeros, 0)); |
2515 | 55.3k | auto grouping = Grouping(loc, specs.localized()); |
2516 | 55.3k | size += to_unsigned(grouping.count_separators(exp)); |
2517 | 55.3k | return write_padded<Char, align::right>(out, specs, size, [&](iterator it) { |
2518 | 55.0k | if (s != sign::none) *it++ = detail::getsign<Char>(s); |
2519 | 55.0k | it = write_significand(it, significand, significand_size, exp, |
2520 | 55.0k | decimal_point, grouping); |
2521 | 55.0k | return num_zeros > 0 ? detail::fill_n(it, num_zeros, zero) : it; |
2522 | 55.0k | }); fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#3}::operator()(fmt::v11::basic_appender<char>) const Line | Count | Source | 2517 | 5.90k | return write_padded<Char, align::right>(out, specs, size, [&](iterator it) { | 2518 | 5.90k | if (s != sign::none) *it++ = detail::getsign<Char>(s); | 2519 | 5.90k | it = write_significand(it, significand, significand_size, exp, | 2520 | 5.90k | decimal_point, grouping); | 2521 | 5.90k | return num_zeros > 0 ? detail::fill_n(it, num_zeros, zero) : it; | 2522 | 5.90k | }); |
fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#3}::operator()(fmt::v11::basic_appender<char>) const Line | Count | Source | 2517 | 5.54k | return write_padded<Char, align::right>(out, specs, size, [&](iterator it) { | 2518 | 5.54k | if (s != sign::none) *it++ = detail::getsign<Char>(s); | 2519 | 5.54k | it = write_significand(it, significand, significand_size, exp, | 2520 | 5.54k | decimal_point, grouping); | 2521 | 5.54k | return num_zeros > 0 ? detail::fill_n(it, num_zeros, zero) : it; | 2522 | 5.54k | }); |
fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#3}::operator()(fmt::v11::basic_appender<char>) const Line | Count | Source | 2517 | 43.5k | return write_padded<Char, align::right>(out, specs, size, [&](iterator it) { | 2518 | 43.5k | if (s != sign::none) *it++ = detail::getsign<Char>(s); | 2519 | 43.5k | it = write_significand(it, significand, significand_size, exp, | 2520 | 43.5k | decimal_point, grouping); | 2521 | 43.5k | return num_zeros > 0 ? detail::fill_n(it, num_zeros, zero) : it; | 2522 | 43.5k | }); |
|
2523 | 55.3k | } |
2524 | | // 1234e-6 -> 0.001234 |
2525 | 137k | int num_zeros = -exp; |
2526 | 137k | if (significand_size == 0 && specs.precision >= 0 && |
2527 | 137k | specs.precision < num_zeros) { |
2528 | 62.0k | num_zeros = specs.precision; |
2529 | 62.0k | } |
2530 | 137k | bool pointy = num_zeros != 0 || significand_size != 0 || specs.alt(); |
2531 | 137k | size += 1 + (pointy ? 1 : 0) + to_unsigned(num_zeros); |
2532 | 137k | return write_padded<Char, align::right>(out, specs, size, [&](iterator it) { |
2533 | 137k | if (s != sign::none) *it++ = detail::getsign<Char>(s); |
2534 | 137k | *it++ = zero; |
2535 | 137k | if (!pointy) return it; |
2536 | 130k | *it++ = decimal_point; |
2537 | 130k | it = detail::fill_n(it, num_zeros, zero); |
2538 | 130k | return write_significand<Char>(it, significand, significand_size); |
2539 | 137k | }); fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#4}::operator()(fmt::v11::basic_appender<char>) const Line | Count | Source | 2532 | 5.05k | return write_padded<Char, align::right>(out, specs, size, [&](iterator it) { | 2533 | 5.05k | if (s != sign::none) *it++ = detail::getsign<Char>(s); | 2534 | 5.05k | *it++ = zero; | 2535 | 5.05k | if (!pointy) return it; | 2536 | 5.05k | *it++ = decimal_point; | 2537 | 5.05k | it = detail::fill_n(it, num_zeros, zero); | 2538 | 5.05k | return write_significand<Char>(it, significand, significand_size); | 2539 | 5.05k | }); |
fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#4}::operator()(fmt::v11::basic_appender<char>) const Line | Count | Source | 2532 | 5.05k | return write_padded<Char, align::right>(out, specs, size, [&](iterator it) { | 2533 | 5.05k | if (s != sign::none) *it++ = detail::getsign<Char>(s); | 2534 | 5.05k | *it++ = zero; | 2535 | 5.05k | if (!pointy) return it; | 2536 | 5.05k | *it++ = decimal_point; | 2537 | 5.05k | it = detail::fill_n(it, num_zeros, zero); | 2538 | 5.05k | return write_significand<Char>(it, significand, significand_size); | 2539 | 5.05k | }); |
fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref)::{lambda(fmt::v11::basic_appender<char>)#4}::operator()(fmt::v11::basic_appender<char>) const Line | Count | Source | 2532 | 127k | return write_padded<Char, align::right>(out, specs, size, [&](iterator it) { | 2533 | 127k | if (s != sign::none) *it++ = detail::getsign<Char>(s); | 2534 | 127k | *it++ = zero; | 2535 | 127k | if (!pointy) return it; | 2536 | 120k | *it++ = decimal_point; | 2537 | 120k | it = detail::fill_n(it, num_zeros, zero); | 2538 | 120k | return write_significand<Char>(it, significand, significand_size); | 2539 | 127k | }); |
|
2540 | 247k | } fmt::v11::basic_appender<char> fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref) Line | Count | Source | 2440 | 32.2k | locale_ref loc) -> OutputIt { | 2441 | 32.2k | auto significand = f.significand; | 2442 | 32.2k | int significand_size = get_significand_size(f); | 2443 | 32.2k | const Char zero = static_cast<Char>('0'); | 2444 | 32.2k | size_t size = to_unsigned(significand_size) + (s != sign::none ? 1 : 0); | 2445 | 32.2k | using iterator = reserve_iterator<OutputIt>; | 2446 | | | 2447 | 32.2k | Char decimal_point = specs.localized() ? detail::decimal_point<Char>(loc) | 2448 | 32.2k | : static_cast<Char>('.'); | 2449 | | | 2450 | 32.2k | int output_exp = f.exponent + significand_size - 1; | 2451 | 32.2k | auto use_exp_format = [=]() { | 2452 | 32.2k | if (specs.type() == presentation_type::exp) return true; | 2453 | 32.2k | if (specs.type() == presentation_type::fixed) return false; | 2454 | | // Use the fixed notation if the exponent is in [exp_lower, exp_upper), | 2455 | | // e.g. 0.0001 instead of 1e-04. Otherwise use the exponent notation. | 2456 | 32.2k | const int exp_lower = -4, exp_upper = 16; | 2457 | 32.2k | return output_exp < exp_lower || | 2458 | 32.2k | output_exp >= (specs.precision > 0 ? specs.precision : exp_upper); | 2459 | 32.2k | }; | 2460 | 32.2k | if (use_exp_format()) { | 2461 | 12.5k | int num_zeros = 0; | 2462 | 12.5k | if (specs.alt()) { | 2463 | 779 | num_zeros = specs.precision - significand_size; | 2464 | 779 | if (num_zeros < 0) num_zeros = 0; | 2465 | 779 | size += to_unsigned(num_zeros); | 2466 | 11.8k | } else if (significand_size == 1) { | 2467 | 1.64k | decimal_point = Char(); | 2468 | 1.64k | } | 2469 | 12.5k | auto abs_output_exp = output_exp >= 0 ? output_exp : -output_exp; | 2470 | 12.5k | int exp_digits = 2; | 2471 | 12.5k | if (abs_output_exp >= 100) exp_digits = abs_output_exp >= 1000 ? 4 : 3; | 2472 | | | 2473 | 12.5k | size += to_unsigned((decimal_point ? 1 : 0) + 2 + exp_digits); | 2474 | 12.5k | char exp_char = specs.upper() ? 'E' : 'e'; | 2475 | 12.5k | auto write = [=](iterator it) { | 2476 | 12.5k | if (s != sign::none) *it++ = detail::getsign<Char>(s); | 2477 | | // Insert a decimal point after the first digit and add an exponent. | 2478 | 12.5k | it = write_significand(it, significand, significand_size, 1, | 2479 | 12.5k | decimal_point); | 2480 | 12.5k | if (num_zeros > 0) it = detail::fill_n(it, num_zeros, zero); | 2481 | 12.5k | *it++ = static_cast<Char>(exp_char); | 2482 | 12.5k | return write_exponent<Char>(output_exp, it); | 2483 | 12.5k | }; | 2484 | 12.5k | return specs.width > 0 | 2485 | 12.5k | ? write_padded<Char, align::right>(out, specs, size, write) | 2486 | 12.5k | : base_iterator(out, write(reserve(out, size))); | 2487 | 12.5k | } | 2488 | | | 2489 | 19.7k | int exp = f.exponent + significand_size; | 2490 | 19.7k | if (f.exponent >= 0) { | 2491 | | // 1234e5 -> 123400000[.0+] | 2492 | 8.65k | size += to_unsigned(f.exponent); | 2493 | 8.65k | int num_zeros = specs.precision - exp; | 2494 | 8.65k | abort_fuzzing_if(num_zeros > 5000); | 2495 | 8.65k | if (specs.alt()) { | 2496 | 724 | ++size; | 2497 | 724 | if (num_zeros <= 0 && specs.type() != presentation_type::fixed) | 2498 | 724 | num_zeros = 0; | 2499 | 724 | if (num_zeros > 0) size += to_unsigned(num_zeros); | 2500 | 724 | } | 2501 | 8.65k | auto grouping = Grouping(loc, specs.localized()); | 2502 | 8.65k | size += to_unsigned(grouping.count_separators(exp)); | 2503 | 8.65k | return write_padded<Char, align::right>(out, specs, size, [&](iterator it) { | 2504 | 8.65k | if (s != sign::none) *it++ = detail::getsign<Char>(s); | 2505 | 8.65k | it = write_significand<Char>(it, significand, significand_size, | 2506 | 8.65k | f.exponent, grouping); | 2507 | 8.65k | if (!specs.alt()) return it; | 2508 | 8.65k | *it++ = decimal_point; | 2509 | 8.65k | return num_zeros > 0 ? detail::fill_n(it, num_zeros, zero) : it; | 2510 | 8.65k | }); | 2511 | 11.0k | } else if (exp > 0) { | 2512 | | // 1234e-2 -> 12.34[0+] | 2513 | 5.99k | int num_zeros = specs.alt() ? specs.precision - significand_size : 0; | 2514 | 5.99k | size += 1 + static_cast<unsigned>(max_of(num_zeros, 0)); | 2515 | 5.99k | auto grouping = Grouping(loc, specs.localized()); | 2516 | 5.99k | size += to_unsigned(grouping.count_separators(exp)); | 2517 | 5.99k | return write_padded<Char, align::right>(out, specs, size, [&](iterator it) { | 2518 | 5.99k | if (s != sign::none) *it++ = detail::getsign<Char>(s); | 2519 | 5.99k | it = write_significand(it, significand, significand_size, exp, | 2520 | 5.99k | decimal_point, grouping); | 2521 | 5.99k | return num_zeros > 0 ? detail::fill_n(it, num_zeros, zero) : it; | 2522 | 5.99k | }); | 2523 | 5.99k | } | 2524 | | // 1234e-6 -> 0.001234 | 2525 | 5.06k | int num_zeros = -exp; | 2526 | 5.06k | if (significand_size == 0 && specs.precision >= 0 && | 2527 | 5.06k | specs.precision < num_zeros) { | 2528 | 0 | num_zeros = specs.precision; | 2529 | 0 | } | 2530 | 5.06k | bool pointy = num_zeros != 0 || significand_size != 0 || specs.alt(); | 2531 | 5.06k | size += 1 + (pointy ? 1 : 0) + to_unsigned(num_zeros); | 2532 | 5.06k | return write_padded<Char, align::right>(out, specs, size, [&](iterator it) { | 2533 | 5.06k | if (s != sign::none) *it++ = detail::getsign<Char>(s); | 2534 | 5.06k | *it++ = zero; | 2535 | 5.06k | if (!pointy) return it; | 2536 | 5.06k | *it++ = decimal_point; | 2537 | 5.06k | it = detail::fill_n(it, num_zeros, zero); | 2538 | 5.06k | return write_significand<Char>(it, significand, significand_size); | 2539 | 5.06k | }); | 2540 | 19.7k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double>, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref) Line | Count | Source | 2440 | 35.8k | locale_ref loc) -> OutputIt { | 2441 | 35.8k | auto significand = f.significand; | 2442 | 35.8k | int significand_size = get_significand_size(f); | 2443 | 35.8k | const Char zero = static_cast<Char>('0'); | 2444 | 35.8k | size_t size = to_unsigned(significand_size) + (s != sign::none ? 1 : 0); | 2445 | 35.8k | using iterator = reserve_iterator<OutputIt>; | 2446 | | | 2447 | 35.8k | Char decimal_point = specs.localized() ? detail::decimal_point<Char>(loc) | 2448 | 35.8k | : static_cast<Char>('.'); | 2449 | | | 2450 | 35.8k | int output_exp = f.exponent + significand_size - 1; | 2451 | 35.8k | auto use_exp_format = [=]() { | 2452 | 35.8k | if (specs.type() == presentation_type::exp) return true; | 2453 | 35.8k | if (specs.type() == presentation_type::fixed) return false; | 2454 | | // Use the fixed notation if the exponent is in [exp_lower, exp_upper), | 2455 | | // e.g. 0.0001 instead of 1e-04. Otherwise use the exponent notation. | 2456 | 35.8k | const int exp_lower = -4, exp_upper = 16; | 2457 | 35.8k | return output_exp < exp_lower || | 2458 | 35.8k | output_exp >= (specs.precision > 0 ? specs.precision : exp_upper); | 2459 | 35.8k | }; | 2460 | 35.8k | if (use_exp_format()) { | 2461 | 16.8k | int num_zeros = 0; | 2462 | 16.8k | if (specs.alt()) { | 2463 | 772 | num_zeros = specs.precision - significand_size; | 2464 | 772 | if (num_zeros < 0) num_zeros = 0; | 2465 | 772 | size += to_unsigned(num_zeros); | 2466 | 16.1k | } else if (significand_size == 1) { | 2467 | 1.86k | decimal_point = Char(); | 2468 | 1.86k | } | 2469 | 16.8k | auto abs_output_exp = output_exp >= 0 ? output_exp : -output_exp; | 2470 | 16.8k | int exp_digits = 2; | 2471 | 16.8k | if (abs_output_exp >= 100) exp_digits = abs_output_exp >= 1000 ? 4 : 3; | 2472 | | | 2473 | 16.8k | size += to_unsigned((decimal_point ? 1 : 0) + 2 + exp_digits); | 2474 | 16.8k | char exp_char = specs.upper() ? 'E' : 'e'; | 2475 | 16.8k | auto write = [=](iterator it) { | 2476 | 16.8k | if (s != sign::none) *it++ = detail::getsign<Char>(s); | 2477 | | // Insert a decimal point after the first digit and add an exponent. | 2478 | 16.8k | it = write_significand(it, significand, significand_size, 1, | 2479 | 16.8k | decimal_point); | 2480 | 16.8k | if (num_zeros > 0) it = detail::fill_n(it, num_zeros, zero); | 2481 | 16.8k | *it++ = static_cast<Char>(exp_char); | 2482 | 16.8k | return write_exponent<Char>(output_exp, it); | 2483 | 16.8k | }; | 2484 | 16.8k | return specs.width > 0 | 2485 | 16.8k | ? write_padded<Char, align::right>(out, specs, size, write) | 2486 | 16.8k | : base_iterator(out, write(reserve(out, size))); | 2487 | 16.8k | } | 2488 | | | 2489 | 18.9k | int exp = f.exponent + significand_size; | 2490 | 18.9k | if (f.exponent >= 0) { | 2491 | | // 1234e5 -> 123400000[.0+] | 2492 | 8.13k | size += to_unsigned(f.exponent); | 2493 | 8.13k | int num_zeros = specs.precision - exp; | 2494 | 8.13k | abort_fuzzing_if(num_zeros > 5000); | 2495 | 8.13k | if (specs.alt()) { | 2496 | 1.09k | ++size; | 2497 | 1.09k | if (num_zeros <= 0 && specs.type() != presentation_type::fixed) | 2498 | 1.09k | num_zeros = 0; | 2499 | 1.09k | if (num_zeros > 0) size += to_unsigned(num_zeros); | 2500 | 1.09k | } | 2501 | 8.13k | auto grouping = Grouping(loc, specs.localized()); | 2502 | 8.13k | size += to_unsigned(grouping.count_separators(exp)); | 2503 | 8.13k | return write_padded<Char, align::right>(out, specs, size, [&](iterator it) { | 2504 | 8.13k | if (s != sign::none) *it++ = detail::getsign<Char>(s); | 2505 | 8.13k | it = write_significand<Char>(it, significand, significand_size, | 2506 | 8.13k | f.exponent, grouping); | 2507 | 8.13k | if (!specs.alt()) return it; | 2508 | 8.13k | *it++ = decimal_point; | 2509 | 8.13k | return num_zeros > 0 ? detail::fill_n(it, num_zeros, zero) : it; | 2510 | 8.13k | }); | 2511 | 10.7k | } else if (exp > 0) { | 2512 | | // 1234e-2 -> 12.34[0+] | 2513 | 5.63k | int num_zeros = specs.alt() ? specs.precision - significand_size : 0; | 2514 | 5.63k | size += 1 + static_cast<unsigned>(max_of(num_zeros, 0)); | 2515 | 5.63k | auto grouping = Grouping(loc, specs.localized()); | 2516 | 5.63k | size += to_unsigned(grouping.count_separators(exp)); | 2517 | 5.63k | return write_padded<Char, align::right>(out, specs, size, [&](iterator it) { | 2518 | 5.63k | if (s != sign::none) *it++ = detail::getsign<Char>(s); | 2519 | 5.63k | it = write_significand(it, significand, significand_size, exp, | 2520 | 5.63k | decimal_point, grouping); | 2521 | 5.63k | return num_zeros > 0 ? detail::fill_n(it, num_zeros, zero) : it; | 2522 | 5.63k | }); | 2523 | 5.63k | } | 2524 | | // 1234e-6 -> 0.001234 | 2525 | 5.16k | int num_zeros = -exp; | 2526 | 5.16k | if (significand_size == 0 && specs.precision >= 0 && | 2527 | 5.16k | specs.precision < num_zeros) { | 2528 | 0 | num_zeros = specs.precision; | 2529 | 0 | } | 2530 | 5.16k | bool pointy = num_zeros != 0 || significand_size != 0 || specs.alt(); | 2531 | 5.16k | size += 1 + (pointy ? 1 : 0) + to_unsigned(num_zeros); | 2532 | 5.16k | return write_padded<Char, align::right>(out, specs, size, [&](iterator it) { | 2533 | 5.16k | if (s != sign::none) *it++ = detail::getsign<Char>(s); | 2534 | 5.16k | *it++ = zero; | 2535 | 5.16k | if (!pointy) return it; | 2536 | 5.16k | *it++ = decimal_point; | 2537 | 5.16k | it = detail::fill_n(it, num_zeros, zero); | 2538 | 5.16k | return write_significand<Char>(it, significand, significand_size); | 2539 | 5.16k | }); | 2540 | 18.9k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp, fmt::v11::detail::digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref) Line | Count | Source | 2440 | 276k | locale_ref loc) -> OutputIt { | 2441 | 276k | auto significand = f.significand; | 2442 | 276k | int significand_size = get_significand_size(f); | 2443 | 276k | const Char zero = static_cast<Char>('0'); | 2444 | 276k | size_t size = to_unsigned(significand_size) + (s != sign::none ? 1 : 0); | 2445 | 276k | using iterator = reserve_iterator<OutputIt>; | 2446 | | | 2447 | 276k | Char decimal_point = specs.localized() ? detail::decimal_point<Char>(loc) | 2448 | 276k | : static_cast<Char>('.'); | 2449 | | | 2450 | 276k | int output_exp = f.exponent + significand_size - 1; | 2451 | 276k | auto use_exp_format = [=]() { | 2452 | 276k | if (specs.type() == presentation_type::exp) return true; | 2453 | 276k | if (specs.type() == presentation_type::fixed) return false; | 2454 | | // Use the fixed notation if the exponent is in [exp_lower, exp_upper), | 2455 | | // e.g. 0.0001 instead of 1e-04. Otherwise use the exponent notation. | 2456 | 276k | const int exp_lower = -4, exp_upper = 16; | 2457 | 276k | return output_exp < exp_lower || | 2458 | 276k | output_exp >= (specs.precision > 0 ? specs.precision : exp_upper); | 2459 | 276k | }; | 2460 | 276k | if (use_exp_format()) { | 2461 | 67.5k | int num_zeros = 0; | 2462 | 67.5k | if (specs.alt()) { | 2463 | 5.66k | num_zeros = specs.precision - significand_size; | 2464 | 5.66k | if (num_zeros < 0) num_zeros = 0; | 2465 | 5.66k | size += to_unsigned(num_zeros); | 2466 | 61.8k | } else if (significand_size == 1) { | 2467 | 5.89k | decimal_point = Char(); | 2468 | 5.89k | } | 2469 | 67.5k | auto abs_output_exp = output_exp >= 0 ? output_exp : -output_exp; | 2470 | 67.5k | int exp_digits = 2; | 2471 | 67.5k | if (abs_output_exp >= 100) exp_digits = abs_output_exp >= 1000 ? 4 : 3; | 2472 | | | 2473 | 67.5k | size += to_unsigned((decimal_point ? 1 : 0) + 2 + exp_digits); | 2474 | 67.5k | char exp_char = specs.upper() ? 'E' : 'e'; | 2475 | 67.5k | auto write = [=](iterator it) { | 2476 | 67.5k | if (s != sign::none) *it++ = detail::getsign<Char>(s); | 2477 | | // Insert a decimal point after the first digit and add an exponent. | 2478 | 67.5k | it = write_significand(it, significand, significand_size, 1, | 2479 | 67.5k | decimal_point); | 2480 | 67.5k | if (num_zeros > 0) it = detail::fill_n(it, num_zeros, zero); | 2481 | 67.5k | *it++ = static_cast<Char>(exp_char); | 2482 | 67.5k | return write_exponent<Char>(output_exp, it); | 2483 | 67.5k | }; | 2484 | 67.5k | return specs.width > 0 | 2485 | 67.5k | ? write_padded<Char, align::right>(out, specs, size, write) | 2486 | 67.5k | : base_iterator(out, write(reserve(out, size))); | 2487 | 67.5k | } | 2488 | | | 2489 | 209k | int exp = f.exponent + significand_size; | 2490 | 209k | if (f.exponent >= 0) { | 2491 | | // 1234e5 -> 123400000[.0+] | 2492 | 37.8k | size += to_unsigned(f.exponent); | 2493 | 37.8k | int num_zeros = specs.precision - exp; | 2494 | 37.8k | abort_fuzzing_if(num_zeros > 5000); | 2495 | 37.8k | if (specs.alt()) { | 2496 | 2.95k | ++size; | 2497 | 2.95k | if (num_zeros <= 0 && specs.type() != presentation_type::fixed) | 2498 | 1.08k | num_zeros = 0; | 2499 | 2.95k | if (num_zeros > 0) size += to_unsigned(num_zeros); | 2500 | 2.95k | } | 2501 | 37.8k | auto grouping = Grouping(loc, specs.localized()); | 2502 | 37.8k | size += to_unsigned(grouping.count_separators(exp)); | 2503 | 37.8k | return write_padded<Char, align::right>(out, specs, size, [&](iterator it) { | 2504 | 37.8k | if (s != sign::none) *it++ = detail::getsign<Char>(s); | 2505 | 37.8k | it = write_significand<Char>(it, significand, significand_size, | 2506 | 37.8k | f.exponent, grouping); | 2507 | 37.8k | if (!specs.alt()) return it; | 2508 | 37.8k | *it++ = decimal_point; | 2509 | 37.8k | return num_zeros > 0 ? detail::fill_n(it, num_zeros, zero) : it; | 2510 | 37.8k | }); | 2511 | 171k | } else if (exp > 0) { | 2512 | | // 1234e-2 -> 12.34[0+] | 2513 | 43.7k | int num_zeros = specs.alt() ? specs.precision - significand_size : 0; | 2514 | 43.7k | size += 1 + static_cast<unsigned>(max_of(num_zeros, 0)); | 2515 | 43.7k | auto grouping = Grouping(loc, specs.localized()); | 2516 | 43.7k | size += to_unsigned(grouping.count_separators(exp)); | 2517 | 43.7k | return write_padded<Char, align::right>(out, specs, size, [&](iterator it) { | 2518 | 43.7k | if (s != sign::none) *it++ = detail::getsign<Char>(s); | 2519 | 43.7k | it = write_significand(it, significand, significand_size, exp, | 2520 | 43.7k | decimal_point, grouping); | 2521 | 43.7k | return num_zeros > 0 ? detail::fill_n(it, num_zeros, zero) : it; | 2522 | 43.7k | }); | 2523 | 43.7k | } | 2524 | | // 1234e-6 -> 0.001234 | 2525 | 127k | int num_zeros = -exp; | 2526 | 127k | if (significand_size == 0 && specs.precision >= 0 && | 2527 | 127k | specs.precision < num_zeros) { | 2528 | 62.0k | num_zeros = specs.precision; | 2529 | 62.0k | } | 2530 | 127k | bool pointy = num_zeros != 0 || significand_size != 0 || specs.alt(); | 2531 | 127k | size += 1 + (pointy ? 1 : 0) + to_unsigned(num_zeros); | 2532 | 127k | return write_padded<Char, align::right>(out, specs, size, [&](iterator it) { | 2533 | 127k | if (s != sign::none) *it++ = detail::getsign<Char>(s); | 2534 | 127k | *it++ = zero; | 2535 | 127k | if (!pointy) return it; | 2536 | 127k | *it++ = decimal_point; | 2537 | 127k | it = detail::fill_n(it, num_zeros, zero); | 2538 | 127k | return write_significand<Char>(it, significand, significand_size); | 2539 | 127k | }); | 2540 | 209k | } |
Unexecuted instantiation: fmt::v11::basic_appender<char> fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref) Unexecuted instantiation: fmt::v11::basic_appender<char> fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float>, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref) Unexecuted instantiation: fmt::v11::basic_appender<char> fmt::v11::detail::do_write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double>, fmt::v11::detail::fallback_digit_grouping<char> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref) |
2541 | | |
2542 | | template <typename Char> class fallback_digit_grouping { |
2543 | | public: |
2544 | | constexpr fallback_digit_grouping(locale_ref, bool) {} |
2545 | | |
2546 | 0 | constexpr auto has_separator() const -> bool { return false; } |
2547 | | |
2548 | 0 | constexpr auto count_separators(int) const -> int { return 0; } |
2549 | | |
2550 | | template <typename Out, typename C> |
2551 | 0 | constexpr auto apply(Out out, basic_string_view<C>) const -> Out { |
2552 | 0 | return out; |
2553 | 0 | } |
2554 | | }; |
2555 | | |
2556 | | template <typename Char, typename OutputIt, typename DecimalFP> |
2557 | | FMT_CONSTEXPR20 auto write_float(OutputIt out, const DecimalFP& f, |
2558 | | const format_specs& specs, sign s, |
2559 | 344k | locale_ref loc) -> OutputIt { |
2560 | 344k | if (is_constant_evaluated()) { |
2561 | 0 | return do_write_float<Char, OutputIt, DecimalFP, |
2562 | 0 | fallback_digit_grouping<Char>>(out, f, specs, s, loc); |
2563 | 344k | } else { |
2564 | 344k | return do_write_float<Char>(out, f, specs, s, loc); |
2565 | 344k | } |
2566 | 344k | } fmt::v11::basic_appender<char> fmt::v11::detail::write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<float> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref) Line | Count | Source | 2559 | 32.2k | locale_ref loc) -> OutputIt { | 2560 | 32.2k | if (is_constant_evaluated()) { | 2561 | 0 | return do_write_float<Char, OutputIt, DecimalFP, | 2562 | 0 | fallback_digit_grouping<Char>>(out, f, specs, s, loc); | 2563 | 32.2k | } else { | 2564 | 32.2k | return do_write_float<Char>(out, f, specs, s, loc); | 2565 | 32.2k | } | 2566 | 32.2k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double> >(fmt::v11::basic_appender<char>, fmt::v11::detail::dragonbox::decimal_fp<double> const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref) Line | Count | Source | 2559 | 35.8k | locale_ref loc) -> OutputIt { | 2560 | 35.8k | if (is_constant_evaluated()) { | 2561 | 0 | return do_write_float<Char, OutputIt, DecimalFP, | 2562 | 0 | fallback_digit_grouping<Char>>(out, f, specs, s, loc); | 2563 | 35.8k | } else { | 2564 | 35.8k | return do_write_float<Char>(out, f, specs, s, loc); | 2565 | 35.8k | } | 2566 | 35.8k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_float<char, fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp>(fmt::v11::basic_appender<char>, fmt::v11::detail::big_decimal_fp const&, fmt::v11::format_specs const&, fmt::v11::sign, fmt::v11::detail::locale_ref) Line | Count | Source | 2559 | 276k | locale_ref loc) -> OutputIt { | 2560 | 276k | if (is_constant_evaluated()) { | 2561 | 0 | return do_write_float<Char, OutputIt, DecimalFP, | 2562 | 0 | fallback_digit_grouping<Char>>(out, f, specs, s, loc); | 2563 | 276k | } else { | 2564 | 276k | return do_write_float<Char>(out, f, specs, s, loc); | 2565 | 276k | } | 2566 | 276k | } |
|
2567 | | |
2568 | 3.13M | template <typename T> constexpr auto isnan(T value) -> bool { |
2569 | 3.13M | return value != value; // std::isnan doesn't support __float128. |
2570 | 3.13M | } bool fmt::v11::detail::isnan<long double>(long double) Line | Count | Source | 2568 | 398k | template <typename T> constexpr auto isnan(T value) -> bool { | 2569 | 398k | return value != value; // std::isnan doesn't support __float128. | 2570 | 398k | } |
bool fmt::v11::detail::isnan<float>(float) Line | Count | Source | 2568 | 375k | template <typename T> constexpr auto isnan(T value) -> bool { | 2569 | 375k | return value != value; // std::isnan doesn't support __float128. | 2570 | 375k | } |
bool fmt::v11::detail::isnan<double>(double) Line | Count | Source | 2568 | 400k | template <typename T> constexpr auto isnan(T value) -> bool { | 2569 | 400k | return value != value; // std::isnan doesn't support __float128. | 2570 | 400k | } |
bool fmt::v11::detail::isnan<unsigned int>(unsigned int) Line | Count | Source | 2568 | 567k | template <typename T> constexpr auto isnan(T value) -> bool { | 2569 | 567k | return value != value; // std::isnan doesn't support __float128. | 2570 | 567k | } |
bool fmt::v11::detail::isnan<char>(char) Line | Count | Source | 2568 | 165k | template <typename T> constexpr auto isnan(T value) -> bool { | 2569 | 165k | return value != value; // std::isnan doesn't support __float128. | 2570 | 165k | } |
bool fmt::v11::detail::isnan<signed char>(signed char) Line | Count | Source | 2568 | 149k | template <typename T> constexpr auto isnan(T value) -> bool { | 2569 | 149k | return value != value; // std::isnan doesn't support __float128. | 2570 | 149k | } |
bool fmt::v11::detail::isnan<unsigned char>(unsigned char) Line | Count | Source | 2568 | 147k | template <typename T> constexpr auto isnan(T value) -> bool { | 2569 | 147k | return value != value; // std::isnan doesn't support __float128. | 2570 | 147k | } |
bool fmt::v11::detail::isnan<short>(short) Line | Count | Source | 2568 | 152k | template <typename T> constexpr auto isnan(T value) -> bool { | 2569 | 152k | return value != value; // std::isnan doesn't support __float128. | 2570 | 152k | } |
bool fmt::v11::detail::isnan<unsigned short>(unsigned short) Line | Count | Source | 2568 | 147k | template <typename T> constexpr auto isnan(T value) -> bool { | 2569 | 147k | return value != value; // std::isnan doesn't support __float128. | 2570 | 147k | } |
bool fmt::v11::detail::isnan<int>(int) Line | Count | Source | 2568 | 155k | template <typename T> constexpr auto isnan(T value) -> bool { | 2569 | 155k | return value != value; // std::isnan doesn't support __float128. | 2570 | 155k | } |
bool fmt::v11::detail::isnan<unsigned long>(unsigned long) Line | Count | Source | 2568 | 285k | template <typename T> constexpr auto isnan(T value) -> bool { | 2569 | 285k | return value != value; // std::isnan doesn't support __float128. | 2570 | 285k | } |
bool fmt::v11::detail::isnan<long>(long) Line | Count | Source | 2568 | 185k | template <typename T> constexpr auto isnan(T value) -> bool { | 2569 | 185k | return value != value; // std::isnan doesn't support __float128. | 2570 | 185k | } |
|
2571 | | |
2572 | | template <typename T, typename Enable = void> |
2573 | | struct has_isfinite : std::false_type {}; |
2574 | | |
2575 | | template <typename T> |
2576 | | struct has_isfinite<T, enable_if_t<sizeof(std::isfinite(T())) != 0>> |
2577 | | : std::true_type {}; |
2578 | | |
2579 | | template <typename T, FMT_ENABLE_IF(std::is_floating_point<T>::value&& |
2580 | | has_isfinite<T>::value)> |
2581 | 1.64M | FMT_CONSTEXPR20 auto isfinite(T value) -> bool { |
2582 | 1.64M | constexpr T inf = T(std::numeric_limits<double>::infinity()); |
2583 | 1.64M | if (is_constant_evaluated()) |
2584 | 0 | return !detail::isnan(value) && value < inf && value > -inf; |
2585 | 1.64M | return std::isfinite(value); |
2586 | 1.64M | } _ZN3fmt3v116detail8isfiniteIeTnNSt3__19enable_ifIXaasr3std17is_floating_pointIT_EE5valuesr12has_isfiniteIS5_EE5valueEiE4typeELi0EEEbS5_ Line | Count | Source | 2581 | 561k | FMT_CONSTEXPR20 auto isfinite(T value) -> bool { | 2582 | 561k | constexpr T inf = T(std::numeric_limits<double>::infinity()); | 2583 | 561k | if (is_constant_evaluated()) | 2584 | 0 | return !detail::isnan(value) && value < inf && value > -inf; | 2585 | 561k | return std::isfinite(value); | 2586 | 561k | } |
_ZN3fmt3v116detail8isfiniteIfTnNSt3__19enable_ifIXaasr3std17is_floating_pointIT_EE5valuesr12has_isfiniteIS5_EE5valueEiE4typeELi0EEEbS5_ Line | Count | Source | 2581 | 526k | FMT_CONSTEXPR20 auto isfinite(T value) -> bool { | 2582 | 526k | constexpr T inf = T(std::numeric_limits<double>::infinity()); | 2583 | 526k | if (is_constant_evaluated()) | 2584 | 0 | return !detail::isnan(value) && value < inf && value > -inf; | 2585 | 526k | return std::isfinite(value); | 2586 | 526k | } |
_ZN3fmt3v116detail8isfiniteIdTnNSt3__19enable_ifIXaasr3std17is_floating_pointIT_EE5valuesr12has_isfiniteIS5_EE5valueEiE4typeELi0EEEbS5_ Line | Count | Source | 2581 | 553k | FMT_CONSTEXPR20 auto isfinite(T value) -> bool { | 2582 | 553k | constexpr T inf = T(std::numeric_limits<double>::infinity()); | 2583 | 553k | if (is_constant_evaluated()) | 2584 | 0 | return !detail::isnan(value) && value < inf && value > -inf; | 2585 | 553k | return std::isfinite(value); | 2586 | 553k | } |
|
2587 | | template <typename T, FMT_ENABLE_IF(!has_isfinite<T>::value)> |
2588 | | FMT_CONSTEXPR auto isfinite(T value) -> bool { |
2589 | | T inf = T(std::numeric_limits<double>::infinity()); |
2590 | | // std::isfinite doesn't support __float128. |
2591 | | return !detail::isnan(value) && value < inf && value > -inf; |
2592 | | } |
2593 | | |
2594 | | template <typename T, FMT_ENABLE_IF(is_floating_point<T>::value)> |
2595 | 392k | FMT_INLINE FMT_CONSTEXPR bool signbit(T value) { |
2596 | 392k | if (is_constant_evaluated()) { |
2597 | | #ifdef __cpp_if_constexpr |
2598 | | if constexpr (std::numeric_limits<double>::is_iec559) { |
2599 | | auto bits = detail::bit_cast<uint64_t>(static_cast<double>(value)); |
2600 | | return (bits >> (num_bits<uint64_t>() - 1)) != 0; |
2601 | | } |
2602 | | #endif |
2603 | 0 | } |
2604 | 392k | return std::signbit(static_cast<double>(value)); |
2605 | 392k | } _ZN3fmt3v116detail7signbitIfTnNSt3__19enable_ifIXsr17is_floating_pointIT_EE5valueEiE4typeELi0EEEbS5_ Line | Count | Source | 2595 | 128k | FMT_INLINE FMT_CONSTEXPR bool signbit(T value) { | 2596 | 128k | if (is_constant_evaluated()) { | 2597 | | #ifdef __cpp_if_constexpr | 2598 | | if constexpr (std::numeric_limits<double>::is_iec559) { | 2599 | | auto bits = detail::bit_cast<uint64_t>(static_cast<double>(value)); | 2600 | | return (bits >> (num_bits<uint64_t>() - 1)) != 0; | 2601 | | } | 2602 | | #endif | 2603 | 0 | } | 2604 | 128k | return std::signbit(static_cast<double>(value)); | 2605 | 128k | } |
_ZN3fmt3v116detail7signbitIdTnNSt3__19enable_ifIXsr17is_floating_pointIT_EE5valueEiE4typeELi0EEEbS5_ Line | Count | Source | 2595 | 135k | FMT_INLINE FMT_CONSTEXPR bool signbit(T value) { | 2596 | 135k | if (is_constant_evaluated()) { | 2597 | | #ifdef __cpp_if_constexpr | 2598 | | if constexpr (std::numeric_limits<double>::is_iec559) { | 2599 | | auto bits = detail::bit_cast<uint64_t>(static_cast<double>(value)); | 2600 | | return (bits >> (num_bits<uint64_t>() - 1)) != 0; | 2601 | | } | 2602 | | #endif | 2603 | 0 | } | 2604 | 135k | return std::signbit(static_cast<double>(value)); | 2605 | 135k | } |
_ZN3fmt3v116detail7signbitIeTnNSt3__19enable_ifIXsr17is_floating_pointIT_EE5valueEiE4typeELi0EEEbS5_ Line | Count | Source | 2595 | 128k | FMT_INLINE FMT_CONSTEXPR bool signbit(T value) { | 2596 | 128k | if (is_constant_evaluated()) { | 2597 | | #ifdef __cpp_if_constexpr | 2598 | | if constexpr (std::numeric_limits<double>::is_iec559) { | 2599 | | auto bits = detail::bit_cast<uint64_t>(static_cast<double>(value)); | 2600 | | return (bits >> (num_bits<uint64_t>() - 1)) != 0; | 2601 | | } | 2602 | | #endif | 2603 | 0 | } | 2604 | 128k | return std::signbit(static_cast<double>(value)); | 2605 | 128k | } |
|
2606 | | |
2607 | 159k | inline FMT_CONSTEXPR20 void adjust_precision(int& precision, int exp10) { |
2608 | | // Adjust fixed precision by exponent because it is relative to decimal |
2609 | | // point. |
2610 | 159k | if (exp10 > 0 && precision > max_value<int>() - exp10) |
2611 | 8 | FMT_THROW(format_error("number is too big")); |
2612 | 159k | precision += exp10; |
2613 | 159k | } |
2614 | | |
2615 | | class bigint { |
2616 | | private: |
2617 | | // A bigint is a number in the form bigit_[N - 1] ... bigit_[0] * 32^exp_. |
2618 | | using bigit = uint32_t; // A big digit. |
2619 | | using double_bigit = uint64_t; |
2620 | | enum { bigit_bits = num_bits<bigit>() }; |
2621 | | enum { bigits_capacity = 32 }; |
2622 | | basic_memory_buffer<bigit, bigits_capacity> bigits_; |
2623 | | int exp_; |
2624 | | |
2625 | | friend struct formatter<bigint>; |
2626 | | |
2627 | 2.36M | FMT_CONSTEXPR auto get_bigit(int i) const -> bigit { |
2628 | 2.36M | return i >= exp_ && i < num_bigits() ? bigits_[i - exp_] : 0; |
2629 | 2.36M | } |
2630 | | |
2631 | 1.45G | FMT_CONSTEXPR void subtract_bigits(int index, bigit other, bigit& borrow) { |
2632 | 1.45G | auto result = double_bigit(bigits_[index]) - other - borrow; |
2633 | 1.45G | bigits_[index] = static_cast<bigit>(result); |
2634 | 1.45G | borrow = static_cast<bigit>(result >> (bigit_bits * 2 - 1)); |
2635 | 1.45G | } |
2636 | | |
2637 | 15.3M | FMT_CONSTEXPR void remove_leading_zeros() { |
2638 | 15.3M | int num_bigits = static_cast<int>(bigits_.size()) - 1; |
2639 | 16.6M | while (num_bigits > 0 && bigits_[num_bigits] == 0) --num_bigits; |
2640 | 15.3M | bigits_.resize(to_unsigned(num_bigits + 1)); |
2641 | 15.3M | } |
2642 | | |
2643 | | // Computes *this -= other assuming aligned bigints and *this >= other. |
2644 | 14.6M | FMT_CONSTEXPR void subtract_aligned(const bigint& other) { |
2645 | 14.6M | FMT_ASSERT(other.exp_ >= exp_, "unaligned bigints"); |
2646 | 14.6M | FMT_ASSERT(compare(*this, other) >= 0, ""); |
2647 | 14.6M | bigit borrow = 0; |
2648 | 14.6M | int i = other.exp_ - exp_; |
2649 | 1.46G | for (size_t j = 0, n = other.bigits_.size(); j != n; ++i, ++j) |
2650 | 1.45G | subtract_bigits(i, other.bigits_[j], borrow); |
2651 | 14.6M | if (borrow != 0) subtract_bigits(i, 0, borrow); |
2652 | 14.6M | FMT_ASSERT(borrow == 0, ""); |
2653 | 14.6M | remove_leading_zeros(); |
2654 | 14.6M | } |
2655 | | |
2656 | 8.68M | FMT_CONSTEXPR void multiply(uint32_t value) { |
2657 | 8.68M | bigit carry = 0; |
2658 | 8.68M | const double_bigit wide_value = value; |
2659 | 498M | for (size_t i = 0, n = bigits_.size(); i < n; ++i) { |
2660 | 490M | double_bigit result = bigits_[i] * wide_value + carry; |
2661 | 490M | bigits_[i] = static_cast<bigit>(result); |
2662 | 490M | carry = static_cast<bigit>(result >> bigit_bits); |
2663 | 490M | } |
2664 | 8.68M | if (carry != 0) bigits_.push_back(carry); |
2665 | 8.68M | } |
2666 | | |
2667 | | template <typename UInt, FMT_ENABLE_IF(std::is_same<UInt, uint64_t>::value || |
2668 | | std::is_same<UInt, uint128_t>::value)> |
2669 | 65.7k | FMT_CONSTEXPR void multiply(UInt value) { |
2670 | 65.7k | using half_uint = |
2671 | 65.7k | conditional_t<std::is_same<UInt, uint128_t>::value, uint64_t, uint32_t>; |
2672 | 65.7k | const int shift = num_bits<half_uint>() - bigit_bits; |
2673 | 65.7k | const UInt lower = static_cast<half_uint>(value); |
2674 | 65.7k | const UInt upper = value >> num_bits<half_uint>(); |
2675 | 65.7k | UInt carry = 0; |
2676 | 14.4M | for (size_t i = 0, n = bigits_.size(); i < n; ++i) { |
2677 | 14.4M | UInt result = lower * bigits_[i] + static_cast<bigit>(carry); |
2678 | 14.4M | carry = (upper * bigits_[i] << shift) + (result >> bigit_bits) + |
2679 | 14.4M | (carry >> bigit_bits); |
2680 | 14.4M | bigits_[i] = static_cast<bigit>(result); |
2681 | 14.4M | } |
2682 | 162k | while (carry != 0) { |
2683 | 96.2k | bigits_.push_back(static_cast<bigit>(carry)); |
2684 | 96.2k | carry >>= bigit_bits; |
2685 | 96.2k | } |
2686 | 65.7k | } |
2687 | | |
2688 | | template <typename UInt, FMT_ENABLE_IF(std::is_same<UInt, uint64_t>::value || |
2689 | | std::is_same<UInt, uint128_t>::value)> |
2690 | 280k | FMT_CONSTEXPR void assign(UInt n) { |
2691 | 280k | size_t num_bigits = 0; |
2692 | 325k | do { |
2693 | 325k | bigits_[num_bigits++] = static_cast<bigit>(n); |
2694 | 325k | n >>= bigit_bits; |
2695 | 325k | } while (n != 0); |
2696 | 280k | bigits_.resize(num_bigits); |
2697 | 280k | exp_ = 0; |
2698 | 280k | } _ZN3fmt3v116detail6bigint6assignImTnNSt3__19enable_ifIXoosr3std7is_sameIT_mEE5valuesr3std7is_sameIS6_oEE5valueEiE4typeELi0EEEvS6_ Line | Count | Source | 2690 | 232k | FMT_CONSTEXPR void assign(UInt n) { | 2691 | 232k | size_t num_bigits = 0; | 2692 | 232k | do { | 2693 | 232k | bigits_[num_bigits++] = static_cast<bigit>(n); | 2694 | 232k | n >>= bigit_bits; | 2695 | 232k | } while (n != 0); | 2696 | 232k | bigits_.resize(num_bigits); | 2697 | 232k | exp_ = 0; | 2698 | 232k | } |
_ZN3fmt3v116detail6bigint6assignIoTnNSt3__19enable_ifIXoosr3std7is_sameIT_mEE5valuesr3std7is_sameIS6_oEE5valueEiE4typeELi0EEEvS6_ Line | Count | Source | 2690 | 48.7k | FMT_CONSTEXPR void assign(UInt n) { | 2691 | 48.7k | size_t num_bigits = 0; | 2692 | 93.2k | do { | 2693 | 93.2k | bigits_[num_bigits++] = static_cast<bigit>(n); | 2694 | 93.2k | n >>= bigit_bits; | 2695 | 93.2k | } while (n != 0); | 2696 | 48.7k | bigits_.resize(num_bigits); | 2697 | 48.7k | exp_ = 0; | 2698 | 48.7k | } |
|
2699 | | |
2700 | | public: |
2701 | 457k | FMT_CONSTEXPR bigint() : exp_(0) {} |
2702 | 0 | explicit bigint(uint64_t n) { assign(n); } |
2703 | | |
2704 | | bigint(const bigint&) = delete; |
2705 | | void operator=(const bigint&) = delete; |
2706 | | |
2707 | 67.1k | FMT_CONSTEXPR void assign(const bigint& other) { |
2708 | 67.1k | auto size = other.bigits_.size(); |
2709 | 67.1k | bigits_.resize(size); |
2710 | 67.1k | auto data = other.bigits_.data(); |
2711 | 67.1k | copy<bigit>(data, data + size, bigits_.data()); |
2712 | 67.1k | exp_ = other.exp_; |
2713 | 67.1k | } |
2714 | | |
2715 | 280k | template <typename Int> FMT_CONSTEXPR void operator=(Int n) { |
2716 | 280k | FMT_ASSERT(n > 0, ""); |
2717 | 280k | assign(uint64_or_128_t<Int>(n)); |
2718 | 280k | } void fmt::v11::detail::bigint::operator=<int>(int) Line | Count | Source | 2715 | 230k | template <typename Int> FMT_CONSTEXPR void operator=(Int n) { | 2716 | 230k | FMT_ASSERT(n > 0, ""); | 2717 | 230k | assign(uint64_or_128_t<Int>(n)); | 2718 | 230k | } |
void fmt::v11::detail::bigint::operator=<unsigned __int128>(unsigned __int128) Line | Count | Source | 2715 | 48.7k | template <typename Int> FMT_CONSTEXPR void operator=(Int n) { | 2716 | 48.7k | FMT_ASSERT(n > 0, ""); | 2717 | 48.7k | assign(uint64_or_128_t<Int>(n)); | 2718 | 48.7k | } |
void fmt::v11::detail::bigint::operator=<unsigned long long>(unsigned long long) Line | Count | Source | 2715 | 1.40k | template <typename Int> FMT_CONSTEXPR void operator=(Int n) { | 2716 | 1.40k | FMT_ASSERT(n > 0, ""); | 2717 | 1.40k | assign(uint64_or_128_t<Int>(n)); | 2718 | 1.40k | } |
|
2719 | | |
2720 | 79.1M | FMT_CONSTEXPR auto num_bigits() const -> int { |
2721 | 79.1M | return static_cast<int>(bigits_.size()) + exp_; |
2722 | 79.1M | } |
2723 | | |
2724 | 354k | FMT_CONSTEXPR auto operator<<=(int shift) -> bigint& { |
2725 | 354k | FMT_ASSERT(shift >= 0, ""); |
2726 | 354k | exp_ += shift / bigit_bits; |
2727 | 354k | shift %= bigit_bits; |
2728 | 354k | if (shift == 0) return *this; |
2729 | 339k | bigit carry = 0; |
2730 | 33.7M | for (size_t i = 0, n = bigits_.size(); i < n; ++i) { |
2731 | 33.4M | bigit c = bigits_[i] >> (bigit_bits - shift); |
2732 | 33.4M | bigits_[i] = (bigits_[i] << shift) + carry; |
2733 | 33.4M | carry = c; |
2734 | 33.4M | } |
2735 | 339k | if (carry != 0) bigits_.push_back(carry); |
2736 | 339k | return *this; |
2737 | 354k | } |
2738 | | |
2739 | 8.75M | template <typename Int> FMT_CONSTEXPR auto operator*=(Int value) -> bigint& { |
2740 | 8.75M | FMT_ASSERT(value > 0, ""); |
2741 | 8.75M | multiply(uint32_or_64_or_128_t<Int>(value)); |
2742 | 8.75M | return *this; |
2743 | 8.75M | } fmt::v11::detail::bigint& fmt::v11::detail::bigint::operator*=<int>(int) Line | Count | Source | 2739 | 8.68M | template <typename Int> FMT_CONSTEXPR auto operator*=(Int value) -> bigint& { | 2740 | 8.68M | FMT_ASSERT(value > 0, ""); | 2741 | 8.68M | multiply(uint32_or_64_or_128_t<Int>(value)); | 2742 | 8.68M | return *this; | 2743 | 8.68M | } |
fmt::v11::detail::bigint& fmt::v11::detail::bigint::operator*=<unsigned __int128>(unsigned __int128) Line | Count | Source | 2739 | 65.7k | template <typename Int> FMT_CONSTEXPR auto operator*=(Int value) -> bigint& { | 2740 | 65.7k | FMT_ASSERT(value > 0, ""); | 2741 | 65.7k | multiply(uint32_or_64_or_128_t<Int>(value)); | 2742 | 65.7k | return *this; | 2743 | 65.7k | } |
|
2744 | | |
2745 | 37.5M | friend FMT_CONSTEXPR auto compare(const bigint& b1, const bigint& b2) -> int { |
2746 | 37.5M | int num_bigits1 = b1.num_bigits(), num_bigits2 = b2.num_bigits(); |
2747 | 37.5M | if (num_bigits1 != num_bigits2) return num_bigits1 > num_bigits2 ? 1 : -1; |
2748 | 31.1M | int i = static_cast<int>(b1.bigits_.size()) - 1; |
2749 | 31.1M | int j = static_cast<int>(b2.bigits_.size()) - 1; |
2750 | 31.1M | int end = i - j; |
2751 | 31.1M | if (end < 0) end = 0; |
2752 | 31.9M | for (; i >= end; --i, --j) { |
2753 | 31.6M | bigit b1_bigit = b1.bigits_[i], b2_bigit = b2.bigits_[j]; |
2754 | 31.6M | if (b1_bigit != b2_bigit) return b1_bigit > b2_bigit ? 1 : -1; |
2755 | 31.6M | } |
2756 | 350k | if (i != j) return i > j ? 1 : -1; |
2757 | 23.0k | return 0; |
2758 | 350k | } |
2759 | | |
2760 | | // Returns compare(lhs1 + lhs2, rhs). |
2761 | | friend FMT_CONSTEXPR auto add_compare(const bigint& lhs1, const bigint& lhs2, |
2762 | 614k | const bigint& rhs) -> int { |
2763 | 614k | int max_lhs_bigits = max_of(lhs1.num_bigits(), lhs2.num_bigits()); |
2764 | 614k | int num_rhs_bigits = rhs.num_bigits(); |
2765 | 614k | if (max_lhs_bigits + 1 < num_rhs_bigits) return -1; |
2766 | 591k | if (max_lhs_bigits > num_rhs_bigits) return 1; |
2767 | 590k | double_bigit borrow = 0; |
2768 | 590k | int min_exp = min_of(min_of(lhs1.exp_, lhs2.exp_), rhs.exp_); |
2769 | 792k | for (int i = num_rhs_bigits - 1; i >= min_exp; --i) { |
2770 | 788k | double_bigit sum = double_bigit(lhs1.get_bigit(i)) + lhs2.get_bigit(i); |
2771 | 788k | bigit rhs_bigit = rhs.get_bigit(i); |
2772 | 788k | if (sum > rhs_bigit + borrow) return 1; |
2773 | 733k | borrow = rhs_bigit + borrow - sum; |
2774 | 733k | if (borrow > 1) return -1; |
2775 | 202k | borrow <<= bigit_bits; |
2776 | 202k | } |
2777 | 4.17k | return borrow != 0 ? -1 : 0; |
2778 | 590k | } |
2779 | | |
2780 | | // Assigns pow(10, exp) to this bigint. |
2781 | 114k | FMT_CONSTEXPR20 void assign_pow10(int exp) { |
2782 | 114k | FMT_ASSERT(exp >= 0, ""); |
2783 | 114k | if (exp == 0) return *this = 1; |
2784 | 105k | int bitmask = 1 << (num_bits<unsigned>() - |
2785 | 105k | countl_zero(static_cast<uint32_t>(exp)) - 1); |
2786 | | // pow(10, exp) = pow(5, exp) * pow(2, exp). First compute pow(5, exp) by |
2787 | | // repeated squaring and multiplication. |
2788 | 105k | *this = 5; |
2789 | 105k | bitmask >>= 1; |
2790 | 903k | while (bitmask != 0) { |
2791 | 798k | square(); |
2792 | 798k | if ((exp & bitmask) != 0) *this *= 5; |
2793 | 798k | bitmask >>= 1; |
2794 | 798k | } |
2795 | 105k | *this <<= exp; // Multiply by pow(2, exp) by shifting. |
2796 | 105k | } |
2797 | | |
2798 | 798k | FMT_CONSTEXPR20 void square() { |
2799 | 798k | int num_bigits = static_cast<int>(bigits_.size()); |
2800 | 798k | int num_result_bigits = 2 * num_bigits; |
2801 | 798k | basic_memory_buffer<bigit, bigits_capacity> n(std::move(bigits_)); |
2802 | 798k | bigits_.resize(to_unsigned(num_result_bigits)); |
2803 | 798k | auto sum = uint128_t(); |
2804 | 18.0M | for (int bigit_index = 0; bigit_index < num_bigits; ++bigit_index) { |
2805 | | // Compute bigit at position bigit_index of the result by adding |
2806 | | // cross-product terms n[i] * n[j] such that i + j == bigit_index. |
2807 | 953M | for (int i = 0, j = bigit_index; j >= 0; ++i, --j) { |
2808 | | // Most terms are multiplied twice which can be optimized in the future. |
2809 | 935M | sum += double_bigit(n[i]) * n[j]; |
2810 | 935M | } |
2811 | 17.2M | bigits_[bigit_index] = static_cast<bigit>(sum); |
2812 | 17.2M | sum >>= num_bits<bigit>(); // Compute the carry. |
2813 | 17.2M | } |
2814 | | // Do the same for the top half. |
2815 | 18.0M | for (int bigit_index = num_bigits; bigit_index < num_result_bigits; |
2816 | 17.2M | ++bigit_index) { |
2817 | 935M | for (int j = num_bigits - 1, i = bigit_index - j; i < num_bigits;) |
2818 | 918M | sum += double_bigit(n[i++]) * n[j--]; |
2819 | 17.2M | bigits_[bigit_index] = static_cast<bigit>(sum); |
2820 | 17.2M | sum >>= num_bits<bigit>(); |
2821 | 17.2M | } |
2822 | 798k | remove_leading_zeros(); |
2823 | 798k | exp_ *= 2; |
2824 | 798k | } |
2825 | | |
2826 | | // If this bigint has a bigger exponent than other, adds trailing zero to make |
2827 | | // exponents equal. This simplifies some operations such as subtraction. |
2828 | 2.92M | FMT_CONSTEXPR void align(const bigint& other) { |
2829 | 2.92M | int exp_difference = exp_ - other.exp_; |
2830 | 2.92M | if (exp_difference <= 0) return; |
2831 | 14.5k | int num_bigits = static_cast<int>(bigits_.size()); |
2832 | 14.5k | bigits_.resize(to_unsigned(num_bigits + exp_difference)); |
2833 | 55.3k | for (int i = num_bigits - 1, j = i + exp_difference; i >= 0; --i, --j) |
2834 | 40.7k | bigits_[j] = bigits_[i]; |
2835 | 14.5k | memset(bigits_.data(), 0, to_unsigned(exp_difference) * sizeof(bigit)); |
2836 | 14.5k | exp_ -= exp_difference; |
2837 | 14.5k | } |
2838 | | |
2839 | | // Divides this bignum by divisor, assigning the remainder to this and |
2840 | | // returning the quotient. |
2841 | 7.86M | FMT_CONSTEXPR auto divmod_assign(const bigint& divisor) -> int { |
2842 | 7.86M | FMT_ASSERT(this != &divisor, ""); |
2843 | 7.86M | if (compare(*this, divisor) < 0) return 0; |
2844 | 2.92M | FMT_ASSERT(divisor.bigits_[divisor.bigits_.size() - 1u] != 0, ""); |
2845 | 2.92M | align(divisor); |
2846 | 2.92M | int quotient = 0; |
2847 | 14.6M | do { |
2848 | 14.6M | subtract_aligned(divisor); |
2849 | 14.6M | ++quotient; |
2850 | 14.6M | } while (compare(*this, divisor) >= 0); |
2851 | 2.92M | return quotient; |
2852 | 7.86M | } |
2853 | | }; |
2854 | | |
2855 | | // format_dragon flags. |
2856 | | enum dragon { |
2857 | | predecessor_closer = 1, |
2858 | | fixup = 2, // Run fixup to correct exp10 which can be off by one. |
2859 | | fixed = 4, |
2860 | | }; |
2861 | | |
2862 | | // Formats a floating-point number using a variation of the Fixed-Precision |
2863 | | // Positive Floating-Point Printout ((FPP)^2) algorithm by Steele & White: |
2864 | | // https://fmt.dev/papers/p372-steele.pdf. |
2865 | | FMT_CONSTEXPR20 inline void format_dragon(basic_fp<uint128_t> value, |
2866 | | unsigned flags, int num_digits, |
2867 | 114k | buffer<char>& buf, int& exp10) { |
2868 | 114k | bigint numerator; // 2 * R in (FPP)^2. |
2869 | 114k | bigint denominator; // 2 * S in (FPP)^2. |
2870 | | // lower and upper are differences between value and corresponding boundaries. |
2871 | 114k | bigint lower; // (M^- in (FPP)^2). |
2872 | 114k | bigint upper_store; // upper's value if different from lower. |
2873 | 114k | bigint* upper = nullptr; // (M^+ in (FPP)^2). |
2874 | | // Shift numerator and denominator by an extra bit or two (if lower boundary |
2875 | | // is closer) to make lower and upper integers. This eliminates multiplication |
2876 | | // by 2 during later computations. |
2877 | 114k | bool is_predecessor_closer = (flags & dragon::predecessor_closer) != 0; |
2878 | 114k | int shift = is_predecessor_closer ? 2 : 1; |
2879 | 114k | if (value.e >= 0) { |
2880 | 16.7k | numerator = value.f; |
2881 | 16.7k | numerator <<= value.e + shift; |
2882 | 16.7k | lower = 1; |
2883 | 16.7k | lower <<= value.e; |
2884 | 16.7k | if (is_predecessor_closer) { |
2885 | 1.77k | upper_store = 1; |
2886 | 1.77k | upper_store <<= value.e + 1; |
2887 | 1.77k | upper = &upper_store; |
2888 | 1.77k | } |
2889 | 16.7k | denominator.assign_pow10(exp10); |
2890 | 16.7k | denominator <<= shift; |
2891 | 97.7k | } else if (exp10 < 0) { |
2892 | 65.7k | numerator.assign_pow10(-exp10); |
2893 | 65.7k | lower.assign(numerator); |
2894 | 65.7k | if (is_predecessor_closer) { |
2895 | 1.40k | upper_store.assign(numerator); |
2896 | 1.40k | upper_store <<= 1; |
2897 | 1.40k | upper = &upper_store; |
2898 | 1.40k | } |
2899 | 65.7k | numerator *= value.f; |
2900 | 65.7k | numerator <<= shift; |
2901 | 65.7k | denominator = 1; |
2902 | 65.7k | denominator <<= shift - value.e; |
2903 | 65.7k | } else { |
2904 | 32.0k | numerator = value.f; |
2905 | 32.0k | numerator <<= shift; |
2906 | 32.0k | denominator.assign_pow10(exp10); |
2907 | 32.0k | denominator <<= shift - value.e; |
2908 | 32.0k | lower = 1; |
2909 | 32.0k | if (is_predecessor_closer) { |
2910 | 1.40k | upper_store = 1ULL << 1; |
2911 | 1.40k | upper = &upper_store; |
2912 | 1.40k | } |
2913 | 32.0k | } |
2914 | 114k | int even = static_cast<int>((value.f & 1) == 0); |
2915 | 114k | if (!upper) upper = &lower; |
2916 | 114k | bool shortest = num_digits < 0; |
2917 | 114k | if ((flags & dragon::fixup) != 0) { |
2918 | 96.8k | if (add_compare(numerator, *upper, denominator) + even <= 0) { |
2919 | 79.9k | --exp10; |
2920 | 79.9k | numerator *= 10; |
2921 | 79.9k | if (num_digits < 0) { |
2922 | 22.4k | lower *= 10; |
2923 | 22.4k | if (upper != &lower) *upper *= 10; |
2924 | 22.4k | } |
2925 | 79.9k | } |
2926 | 96.8k | if ((flags & dragon::fixed) != 0) adjust_precision(num_digits, exp10 + 1); |
2927 | 96.8k | } |
2928 | | // Invariant: value == (numerator / denominator) * pow(10, exp10). |
2929 | 114k | if (shortest) { |
2930 | | // Generate the shortest representation. |
2931 | 29.1k | num_digits = 0; |
2932 | 29.1k | char* data = buf.data(); |
2933 | 452k | for (;;) { |
2934 | 452k | int digit = numerator.divmod_assign(denominator); |
2935 | 452k | bool low = compare(numerator, lower) - even < 0; // numerator <[=] lower. |
2936 | | // numerator + upper >[=] pow10: |
2937 | 452k | bool high = add_compare(numerator, *upper, denominator) + even > 0; |
2938 | 452k | data[num_digits++] = static_cast<char>('0' + digit); |
2939 | 452k | if (low || high) { |
2940 | 29.1k | if (!low) { |
2941 | 5.61k | ++data[num_digits - 1]; |
2942 | 23.5k | } else if (high) { |
2943 | 13.1k | int result = add_compare(numerator, numerator, denominator); |
2944 | | // Round half to even. |
2945 | 13.1k | if (result > 0 || (result == 0 && (digit % 2) != 0)) |
2946 | 6.48k | ++data[num_digits - 1]; |
2947 | 13.1k | } |
2948 | 29.1k | buf.try_resize(to_unsigned(num_digits)); |
2949 | 29.1k | exp10 -= num_digits - 1; |
2950 | 29.1k | return; |
2951 | 29.1k | } |
2952 | 423k | numerator *= 10; |
2953 | 423k | lower *= 10; |
2954 | 423k | if (upper != &lower) *upper *= 10; |
2955 | 423k | } |
2956 | 29.1k | } |
2957 | | // Generate the given number of digits. |
2958 | 85.3k | exp10 -= num_digits - 1; |
2959 | 85.3k | if (num_digits <= 0) { |
2960 | 35.5k | auto digit = '0'; |
2961 | 35.5k | if (num_digits == 0) { |
2962 | 2.11k | denominator *= 10; |
2963 | 2.11k | digit = add_compare(numerator, numerator, denominator) > 0 ? '1' : '0'; |
2964 | 2.11k | } |
2965 | 35.5k | buf.push_back(digit); |
2966 | 35.5k | return; |
2967 | 35.5k | } |
2968 | 49.7k | buf.try_resize(to_unsigned(num_digits)); |
2969 | 7.41M | for (int i = 0; i < num_digits - 1; ++i) { |
2970 | 7.36M | int digit = numerator.divmod_assign(denominator); |
2971 | 7.36M | buf[i] = static_cast<char>('0' + digit); |
2972 | 7.36M | numerator *= 10; |
2973 | 7.36M | } |
2974 | 49.7k | int digit = numerator.divmod_assign(denominator); |
2975 | 49.7k | auto result = add_compare(numerator, numerator, denominator); |
2976 | 49.7k | if (result > 0 || (result == 0 && (digit % 2) != 0)) { |
2977 | 14.9k | if (digit == 9) { |
2978 | 5.33k | const auto overflow = '0' + 10; |
2979 | 5.33k | buf[num_digits - 1] = overflow; |
2980 | | // Propagate the carry. |
2981 | 21.7k | for (int i = num_digits - 1; i > 0 && buf[i] == overflow; --i) { |
2982 | 16.3k | buf[i] = '0'; |
2983 | 16.3k | ++buf[i - 1]; |
2984 | 16.3k | } |
2985 | 5.33k | if (buf[0] == overflow) { |
2986 | 3.09k | buf[0] = '1'; |
2987 | 3.09k | if ((flags & dragon::fixed) != 0) |
2988 | 1.02k | buf.push_back('0'); |
2989 | 2.06k | else |
2990 | 2.06k | ++exp10; |
2991 | 3.09k | } |
2992 | 5.33k | return; |
2993 | 5.33k | } |
2994 | 9.57k | ++digit; |
2995 | 9.57k | } |
2996 | 44.3k | buf[num_digits - 1] = static_cast<char>('0' + digit); |
2997 | 44.3k | } |
2998 | | |
2999 | | // Formats a floating-point number using the hexfloat format. |
3000 | | template <typename Float, FMT_ENABLE_IF(!is_double_double<Float>::value)> |
3001 | | FMT_CONSTEXPR20 void format_hexfloat(Float value, format_specs specs, |
3002 | 13.7k | buffer<char>& buf) { |
3003 | | // float is passed as double to reduce the number of instantiations and to |
3004 | | // simplify implementation. |
3005 | 13.7k | static_assert(!std::is_same<Float, float>::value, ""); |
3006 | | |
3007 | 13.7k | using info = dragonbox::float_info<Float>; |
3008 | | |
3009 | | // Assume Float is in the format [sign][exponent][significand]. |
3010 | 13.7k | using carrier_uint = typename info::carrier_uint; |
3011 | | |
3012 | 13.7k | const auto num_float_significand_bits = detail::num_significand_bits<Float>(); |
3013 | | |
3014 | 13.7k | basic_fp<carrier_uint> f(value); |
3015 | 13.7k | f.e += num_float_significand_bits; |
3016 | 13.7k | if (!has_implicit_bit<Float>()) --f.e; |
3017 | | |
3018 | 13.7k | const auto num_fraction_bits = |
3019 | 13.7k | num_float_significand_bits + (has_implicit_bit<Float>() ? 1 : 0); |
3020 | 13.7k | const auto num_xdigits = (num_fraction_bits + 3) / 4; |
3021 | | |
3022 | 13.7k | const auto leading_shift = ((num_xdigits - 1) * 4); |
3023 | 13.7k | const auto leading_mask = carrier_uint(0xF) << leading_shift; |
3024 | 13.7k | const auto leading_xdigit = |
3025 | 13.7k | static_cast<uint32_t>((f.f & leading_mask) >> leading_shift); |
3026 | 13.7k | if (leading_xdigit > 1) f.e -= (32 - countl_zero(leading_xdigit) - 1); |
3027 | | |
3028 | 13.7k | int print_xdigits = num_xdigits - 1; |
3029 | 13.7k | if (specs.precision >= 0 && print_xdigits > specs.precision) { |
3030 | 3.98k | const int shift = ((print_xdigits - specs.precision - 1) * 4); |
3031 | 3.98k | const auto mask = carrier_uint(0xF) << shift; |
3032 | 3.98k | const auto v = static_cast<uint32_t>((f.f & mask) >> shift); |
3033 | | |
3034 | 3.98k | if (v >= 8) { |
3035 | 1.47k | const auto inc = carrier_uint(1) << (shift + 4); |
3036 | 1.47k | f.f += inc; |
3037 | 1.47k | f.f &= ~(inc - 1); |
3038 | 1.47k | } |
3039 | | |
3040 | | // Check long double overflow |
3041 | 3.98k | if (!has_implicit_bit<Float>()) { |
3042 | 1.95k | const auto implicit_bit = carrier_uint(1) << num_float_significand_bits; |
3043 | 1.95k | if ((f.f & implicit_bit) == implicit_bit) { |
3044 | 620 | f.f >>= 4; |
3045 | 620 | f.e += 4; |
3046 | 620 | } |
3047 | 1.95k | } |
3048 | | |
3049 | 3.98k | print_xdigits = specs.precision; |
3050 | 3.98k | } |
3051 | | |
3052 | 13.7k | char xdigits[num_bits<carrier_uint>() / 4]; |
3053 | 13.7k | detail::fill_n(xdigits, sizeof(xdigits), '0'); |
3054 | 13.7k | format_base2e(4, xdigits, f.f, num_xdigits, specs.upper()); |
3055 | | |
3056 | | // Remove zero tail |
3057 | 94.9k | while (print_xdigits > 0 && xdigits[print_xdigits] == '0') --print_xdigits; |
3058 | | |
3059 | 13.7k | buf.push_back('0'); |
3060 | 13.7k | buf.push_back(specs.upper() ? 'X' : 'x'); |
3061 | 13.7k | buf.push_back(xdigits[0]); |
3062 | 13.7k | if (specs.alt() || print_xdigits > 0 || print_xdigits < specs.precision) |
3063 | 10.2k | buf.push_back('.'); |
3064 | 13.7k | buf.append(xdigits + 1, xdigits + 1 + print_xdigits); |
3065 | 1.41M | for (; print_xdigits < specs.precision; ++print_xdigits) buf.push_back('0'); |
3066 | | |
3067 | 13.7k | buf.push_back(specs.upper() ? 'P' : 'p'); |
3068 | | |
3069 | 13.7k | uint32_t abs_e; |
3070 | 13.7k | if (f.e < 0) { |
3071 | 8.32k | buf.push_back('-'); |
3072 | 8.32k | abs_e = static_cast<uint32_t>(-f.e); |
3073 | 8.32k | } else { |
3074 | 5.41k | buf.push_back('+'); |
3075 | 5.41k | abs_e = static_cast<uint32_t>(f.e); |
3076 | 5.41k | } |
3077 | 13.7k | format_decimal<char>(appender(buf), abs_e, detail::count_digits(abs_e)); |
3078 | 13.7k | } _ZN3fmt3v116detail15format_hexfloatIeTnNSt3__19enable_ifIXntsr16is_double_doubleIT_EE5valueEiE4typeELi0EEEvS5_NS0_12format_specsERNS1_6bufferIcEE Line | Count | Source | 3002 | 5.71k | buffer<char>& buf) { | 3003 | | // float is passed as double to reduce the number of instantiations and to | 3004 | | // simplify implementation. | 3005 | 5.71k | static_assert(!std::is_same<Float, float>::value, ""); | 3006 | | | 3007 | 5.71k | using info = dragonbox::float_info<Float>; | 3008 | | | 3009 | | // Assume Float is in the format [sign][exponent][significand]. | 3010 | 5.71k | using carrier_uint = typename info::carrier_uint; | 3011 | | | 3012 | 5.71k | const auto num_float_significand_bits = detail::num_significand_bits<Float>(); | 3013 | | | 3014 | 5.71k | basic_fp<carrier_uint> f(value); | 3015 | 5.71k | f.e += num_float_significand_bits; | 3016 | 5.71k | if (!has_implicit_bit<Float>()) --f.e; | 3017 | | | 3018 | 5.71k | const auto num_fraction_bits = | 3019 | 5.71k | num_float_significand_bits + (has_implicit_bit<Float>() ? 1 : 0); | 3020 | 5.71k | const auto num_xdigits = (num_fraction_bits + 3) / 4; | 3021 | | | 3022 | 5.71k | const auto leading_shift = ((num_xdigits - 1) * 4); | 3023 | 5.71k | const auto leading_mask = carrier_uint(0xF) << leading_shift; | 3024 | 5.71k | const auto leading_xdigit = | 3025 | 5.71k | static_cast<uint32_t>((f.f & leading_mask) >> leading_shift); | 3026 | 5.71k | if (leading_xdigit > 1) f.e -= (32 - countl_zero(leading_xdigit) - 1); | 3027 | | | 3028 | 5.71k | int print_xdigits = num_xdigits - 1; | 3029 | 5.71k | if (specs.precision >= 0 && print_xdigits > specs.precision) { | 3030 | 1.95k | const int shift = ((print_xdigits - specs.precision - 1) * 4); | 3031 | 1.95k | const auto mask = carrier_uint(0xF) << shift; | 3032 | 1.95k | const auto v = static_cast<uint32_t>((f.f & mask) >> shift); | 3033 | | | 3034 | 1.95k | if (v >= 8) { | 3035 | 835 | const auto inc = carrier_uint(1) << (shift + 4); | 3036 | 835 | f.f += inc; | 3037 | 835 | f.f &= ~(inc - 1); | 3038 | 835 | } | 3039 | | | 3040 | | // Check long double overflow | 3041 | 1.95k | if (!has_implicit_bit<Float>()) { | 3042 | 1.95k | const auto implicit_bit = carrier_uint(1) << num_float_significand_bits; | 3043 | 1.95k | if ((f.f & implicit_bit) == implicit_bit) { | 3044 | 620 | f.f >>= 4; | 3045 | 620 | f.e += 4; | 3046 | 620 | } | 3047 | 1.95k | } | 3048 | | | 3049 | 1.95k | print_xdigits = specs.precision; | 3050 | 1.95k | } | 3051 | | | 3052 | 5.71k | char xdigits[num_bits<carrier_uint>() / 4]; | 3053 | 5.71k | detail::fill_n(xdigits, sizeof(xdigits), '0'); | 3054 | 5.71k | format_base2e(4, xdigits, f.f, num_xdigits, specs.upper()); | 3055 | | | 3056 | | // Remove zero tail | 3057 | 37.9k | while (print_xdigits > 0 && xdigits[print_xdigits] == '0') --print_xdigits; | 3058 | | | 3059 | 5.71k | buf.push_back('0'); | 3060 | 5.71k | buf.push_back(specs.upper() ? 'X' : 'x'); | 3061 | 5.71k | buf.push_back(xdigits[0]); | 3062 | 5.71k | if (specs.alt() || print_xdigits > 0 || print_xdigits < specs.precision) | 3063 | 4.34k | buf.push_back('.'); | 3064 | 5.71k | buf.append(xdigits + 1, xdigits + 1 + print_xdigits); | 3065 | 715k | for (; print_xdigits < specs.precision; ++print_xdigits) buf.push_back('0'); | 3066 | | | 3067 | 5.71k | buf.push_back(specs.upper() ? 'P' : 'p'); | 3068 | | | 3069 | 5.71k | uint32_t abs_e; | 3070 | 5.71k | if (f.e < 0) { | 3071 | 4.04k | buf.push_back('-'); | 3072 | 4.04k | abs_e = static_cast<uint32_t>(-f.e); | 3073 | 4.04k | } else { | 3074 | 1.67k | buf.push_back('+'); | 3075 | 1.67k | abs_e = static_cast<uint32_t>(f.e); | 3076 | 1.67k | } | 3077 | 5.71k | format_decimal<char>(appender(buf), abs_e, detail::count_digits(abs_e)); | 3078 | 5.71k | } |
_ZN3fmt3v116detail15format_hexfloatIdTnNSt3__19enable_ifIXntsr16is_double_doubleIT_EE5valueEiE4typeELi0EEEvS5_NS0_12format_specsERNS1_6bufferIcEE Line | Count | Source | 3002 | 8.01k | buffer<char>& buf) { | 3003 | | // float is passed as double to reduce the number of instantiations and to | 3004 | | // simplify implementation. | 3005 | 8.01k | static_assert(!std::is_same<Float, float>::value, ""); | 3006 | | | 3007 | 8.01k | using info = dragonbox::float_info<Float>; | 3008 | | | 3009 | | // Assume Float is in the format [sign][exponent][significand]. | 3010 | 8.01k | using carrier_uint = typename info::carrier_uint; | 3011 | | | 3012 | 8.01k | const auto num_float_significand_bits = detail::num_significand_bits<Float>(); | 3013 | | | 3014 | 8.01k | basic_fp<carrier_uint> f(value); | 3015 | 8.01k | f.e += num_float_significand_bits; | 3016 | 8.01k | if (!has_implicit_bit<Float>()) --f.e; | 3017 | | | 3018 | 8.01k | const auto num_fraction_bits = | 3019 | 8.01k | num_float_significand_bits + (has_implicit_bit<Float>() ? 1 : 0); | 3020 | 8.01k | const auto num_xdigits = (num_fraction_bits + 3) / 4; | 3021 | | | 3022 | 8.01k | const auto leading_shift = ((num_xdigits - 1) * 4); | 3023 | 8.01k | const auto leading_mask = carrier_uint(0xF) << leading_shift; | 3024 | 8.01k | const auto leading_xdigit = | 3025 | 8.01k | static_cast<uint32_t>((f.f & leading_mask) >> leading_shift); | 3026 | 8.01k | if (leading_xdigit > 1) f.e -= (32 - countl_zero(leading_xdigit) - 1); | 3027 | | | 3028 | 8.01k | int print_xdigits = num_xdigits - 1; | 3029 | 8.01k | if (specs.precision >= 0 && print_xdigits > specs.precision) { | 3030 | 2.02k | const int shift = ((print_xdigits - specs.precision - 1) * 4); | 3031 | 2.02k | const auto mask = carrier_uint(0xF) << shift; | 3032 | 2.02k | const auto v = static_cast<uint32_t>((f.f & mask) >> shift); | 3033 | | | 3034 | 2.02k | if (v >= 8) { | 3035 | 638 | const auto inc = carrier_uint(1) << (shift + 4); | 3036 | 638 | f.f += inc; | 3037 | 638 | f.f &= ~(inc - 1); | 3038 | 638 | } | 3039 | | | 3040 | | // Check long double overflow | 3041 | 2.02k | if (!has_implicit_bit<Float>()) { | 3042 | 0 | const auto implicit_bit = carrier_uint(1) << num_float_significand_bits; | 3043 | 0 | if ((f.f & implicit_bit) == implicit_bit) { | 3044 | 0 | f.f >>= 4; | 3045 | 0 | f.e += 4; | 3046 | 0 | } | 3047 | 0 | } | 3048 | | | 3049 | 2.02k | print_xdigits = specs.precision; | 3050 | 2.02k | } | 3051 | | | 3052 | 8.01k | char xdigits[num_bits<carrier_uint>() / 4]; | 3053 | 8.01k | detail::fill_n(xdigits, sizeof(xdigits), '0'); | 3054 | 8.01k | format_base2e(4, xdigits, f.f, num_xdigits, specs.upper()); | 3055 | | | 3056 | | // Remove zero tail | 3057 | 56.9k | while (print_xdigits > 0 && xdigits[print_xdigits] == '0') --print_xdigits; | 3058 | | | 3059 | 8.01k | buf.push_back('0'); | 3060 | 8.01k | buf.push_back(specs.upper() ? 'X' : 'x'); | 3061 | 8.01k | buf.push_back(xdigits[0]); | 3062 | 8.01k | if (specs.alt() || print_xdigits > 0 || print_xdigits < specs.precision) | 3063 | 5.88k | buf.push_back('.'); | 3064 | 8.01k | buf.append(xdigits + 1, xdigits + 1 + print_xdigits); | 3065 | 699k | for (; print_xdigits < specs.precision; ++print_xdigits) buf.push_back('0'); | 3066 | | | 3067 | 8.01k | buf.push_back(specs.upper() ? 'P' : 'p'); | 3068 | | | 3069 | 8.01k | uint32_t abs_e; | 3070 | 8.01k | if (f.e < 0) { | 3071 | 4.27k | buf.push_back('-'); | 3072 | 4.27k | abs_e = static_cast<uint32_t>(-f.e); | 3073 | 4.27k | } else { | 3074 | 3.73k | buf.push_back('+'); | 3075 | 3.73k | abs_e = static_cast<uint32_t>(f.e); | 3076 | 3.73k | } | 3077 | 8.01k | format_decimal<char>(appender(buf), abs_e, detail::count_digits(abs_e)); | 3078 | 8.01k | } |
|
3079 | | |
3080 | | template <typename Float, FMT_ENABLE_IF(is_double_double<Float>::value)> |
3081 | | FMT_CONSTEXPR20 void format_hexfloat(Float value, format_specs specs, |
3082 | | buffer<char>& buf) { |
3083 | | format_hexfloat(static_cast<double>(value), specs, buf); |
3084 | | } |
3085 | | |
3086 | 58.8k | constexpr auto fractional_part_rounding_thresholds(int index) -> uint32_t { |
3087 | | // For checking rounding thresholds. |
3088 | | // The kth entry is chosen to be the smallest integer such that the |
3089 | | // upper 32-bits of 10^(k+1) times it is strictly bigger than 5 * 10^k. |
3090 | | // It is equal to ceil(2^31 + 2^32/10^(k + 1)). |
3091 | | // These are stored in a string literal because we cannot have static arrays |
3092 | | // in constexpr functions and non-static ones are poorly optimized. |
3093 | 58.8k | return U"\x9999999a\x828f5c29\x80418938\x80068db9\x8000a7c6\x800010c7" |
3094 | 58.8k | U"\x800001ae\x8000002b"[index]; |
3095 | 58.8k | } |
3096 | | |
3097 | | template <typename Float> |
3098 | | FMT_CONSTEXPR20 auto format_float(Float value, int precision, |
3099 | | const format_specs& specs, bool binary32, |
3100 | 276k | buffer<char>& buf) -> int { |
3101 | | // float is passed as double to reduce the number of instantiations. |
3102 | 276k | static_assert(!std::is_same<Float, float>::value, ""); |
3103 | 276k | auto converted_value = convert_float(value); |
3104 | | |
3105 | 276k | const bool fixed = specs.type() == presentation_type::fixed; |
3106 | 276k | if (value == 0) { |
3107 | 31.3k | if (precision <= 0 || !fixed) { |
3108 | 14.1k | buf.push_back('0'); |
3109 | 14.1k | return 0; |
3110 | 14.1k | } |
3111 | 17.1k | buf.try_resize(to_unsigned(precision)); |
3112 | 17.1k | fill_n(buf.data(), precision, '0'); |
3113 | 17.1k | return -precision; |
3114 | 31.3k | } |
3115 | | |
3116 | 245k | int exp = 0; |
3117 | 245k | bool use_dragon = true; |
3118 | 245k | unsigned dragon_flags = 0; |
3119 | 245k | if (!is_fast_float<Float>() || is_constant_evaluated()) { |
3120 | 96.8k | const auto inv_log2_10 = 0.3010299956639812; // 1 / log2(10) |
3121 | 96.8k | using info = dragonbox::float_info<decltype(converted_value)>; |
3122 | 96.8k | const auto f = basic_fp<typename info::carrier_uint>(converted_value); |
3123 | | // Compute exp, an approximate power of 10, such that |
3124 | | // 10^(exp - 1) <= value < 10^exp or 10^exp <= value < 10^(exp + 1). |
3125 | | // This is based on log10(value) == log2(value) / log2(10) and approximation |
3126 | | // of log2(value) by e + num_fraction_bits idea from double-conversion. |
3127 | 96.8k | auto e = (f.e + count_digits<1>(f.f) - 1) * inv_log2_10 - 1e-10; |
3128 | 96.8k | exp = static_cast<int>(e); |
3129 | 96.8k | if (e > exp) ++exp; // Compute ceil. |
3130 | 96.8k | dragon_flags = dragon::fixup; |
3131 | 148k | } else { |
3132 | | // Extract significand bits and exponent bits. |
3133 | 148k | using info = dragonbox::float_info<double>; |
3134 | 148k | auto br = bit_cast<uint64_t>(static_cast<double>(value)); |
3135 | | |
3136 | 148k | const uint64_t significand_mask = |
3137 | 148k | (static_cast<uint64_t>(1) << num_significand_bits<double>()) - 1; |
3138 | 148k | uint64_t significand = (br & significand_mask); |
3139 | 148k | int exponent = static_cast<int>((br & exponent_mask<double>()) >> |
3140 | 148k | num_significand_bits<double>()); |
3141 | | |
3142 | 148k | if (exponent != 0) { // Check if normal. |
3143 | 135k | exponent -= exponent_bias<double>() + num_significand_bits<double>(); |
3144 | 135k | significand |= |
3145 | 135k | (static_cast<uint64_t>(1) << num_significand_bits<double>()); |
3146 | 135k | significand <<= 1; |
3147 | 135k | } else { |
3148 | | // Normalize subnormal inputs. |
3149 | 13.2k | FMT_ASSERT(significand != 0, "zeros should not appear here"); |
3150 | 13.2k | int shift = countl_zero(significand); |
3151 | 13.2k | FMT_ASSERT(shift >= num_bits<uint64_t>() - num_significand_bits<double>(), |
3152 | 13.2k | ""); |
3153 | 13.2k | shift -= (num_bits<uint64_t>() - num_significand_bits<double>() - 2); |
3154 | 13.2k | exponent = (std::numeric_limits<double>::min_exponent - |
3155 | 13.2k | num_significand_bits<double>()) - |
3156 | 13.2k | shift; |
3157 | 13.2k | significand <<= shift; |
3158 | 13.2k | } |
3159 | | |
3160 | | // Compute the first several nonzero decimal significand digits. |
3161 | | // We call the number we get the first segment. |
3162 | 148k | const int k = info::kappa - dragonbox::floor_log10_pow2(exponent); |
3163 | 148k | exp = -k; |
3164 | 148k | const int beta = exponent + dragonbox::floor_log2_pow10(k); |
3165 | 148k | uint64_t first_segment; |
3166 | 148k | bool has_more_segments; |
3167 | 148k | int digits_in_the_first_segment; |
3168 | 148k | { |
3169 | 148k | const auto r = dragonbox::umul192_upper128( |
3170 | 148k | significand << beta, dragonbox::get_cached_power(k)); |
3171 | 148k | first_segment = r.high(); |
3172 | 148k | has_more_segments = r.low() != 0; |
3173 | | |
3174 | | // The first segment can have 18 ~ 19 digits. |
3175 | 148k | if (first_segment >= 1000000000000000000ULL) { |
3176 | 113k | digits_in_the_first_segment = 19; |
3177 | 113k | } else { |
3178 | | // When it is of 18-digits, we align it to 19-digits by adding a bogus |
3179 | | // zero at the end. |
3180 | 35.1k | digits_in_the_first_segment = 18; |
3181 | 35.1k | first_segment *= 10; |
3182 | 35.1k | } |
3183 | 148k | } |
3184 | | |
3185 | | // Compute the actual number of decimal digits to print. |
3186 | 148k | if (fixed) adjust_precision(precision, exp + digits_in_the_first_segment); |
3187 | | |
3188 | | // Use Dragon4 only when there might be not enough digits in the first |
3189 | | // segment. |
3190 | 148k | if (digits_in_the_first_segment > precision) { |
3191 | 131k | use_dragon = false; |
3192 | | |
3193 | 131k | if (precision <= 0) { |
3194 | 64.1k | exp += digits_in_the_first_segment; |
3195 | | |
3196 | 64.1k | if (precision < 0) { |
3197 | | // Nothing to do, since all we have are just leading zeros. |
3198 | 62.0k | buf.try_resize(0); |
3199 | 62.0k | } else { |
3200 | | // We may need to round-up. |
3201 | 2.08k | buf.try_resize(1); |
3202 | 2.08k | if ((first_segment | static_cast<uint64_t>(has_more_segments)) > |
3203 | 2.08k | 5000000000000000000ULL) { |
3204 | 793 | buf[0] = '1'; |
3205 | 1.29k | } else { |
3206 | 1.29k | buf[0] = '0'; |
3207 | 1.29k | } |
3208 | 2.08k | } |
3209 | 64.1k | } // precision <= 0 |
3210 | 66.9k | else { |
3211 | 66.9k | exp += digits_in_the_first_segment - precision; |
3212 | | |
3213 | | // When precision > 0, we divide the first segment into three |
3214 | | // subsegments, each with 9, 9, and 0 ~ 1 digits so that each fits |
3215 | | // in 32-bits which usually allows faster calculation than in |
3216 | | // 64-bits. Since some compiler (e.g. MSVC) doesn't know how to optimize |
3217 | | // division-by-constant for large 64-bit divisors, we do it here |
3218 | | // manually. The magic number 7922816251426433760 below is equal to |
3219 | | // ceil(2^(64+32) / 10^10). |
3220 | 66.9k | const uint32_t first_subsegment = static_cast<uint32_t>( |
3221 | 66.9k | dragonbox::umul128_upper64(first_segment, 7922816251426433760ULL) >> |
3222 | 66.9k | 32); |
3223 | 66.9k | const uint64_t second_third_subsegments = |
3224 | 66.9k | first_segment - first_subsegment * 10000000000ULL; |
3225 | | |
3226 | 66.9k | uint64_t prod; |
3227 | 66.9k | uint32_t digits; |
3228 | 66.9k | bool should_round_up; |
3229 | 66.9k | int number_of_digits_to_print = min_of(precision, 9); |
3230 | | |
3231 | | // Print a 9-digits subsegment, either the first or the second. |
3232 | 81.5k | auto print_subsegment = [&](uint32_t subsegment, char* buffer) { |
3233 | 81.5k | int number_of_digits_printed = 0; |
3234 | | |
3235 | | // If we want to print an odd number of digits from the subsegment, |
3236 | 81.5k | if ((number_of_digits_to_print & 1) != 0) { |
3237 | | // Convert to 64-bit fixed-point fractional form with 1-digit |
3238 | | // integer part. The magic number 720575941 is a good enough |
3239 | | // approximation of 2^(32 + 24) / 10^8; see |
3240 | | // https://jk-jeon.github.io/posts/2022/12/fixed-precision-formatting/#fixed-length-case |
3241 | | // for details. |
3242 | 40.4k | prod = ((subsegment * static_cast<uint64_t>(720575941)) >> 24) + 1; |
3243 | 40.4k | digits = static_cast<uint32_t>(prod >> 32); |
3244 | 40.4k | *buffer = static_cast<char>('0' + digits); |
3245 | 40.4k | number_of_digits_printed++; |
3246 | 40.4k | } |
3247 | | // If we want to print an even number of digits from the |
3248 | | // first_subsegment, |
3249 | 41.0k | else { |
3250 | | // Convert to 64-bit fixed-point fractional form with 2-digits |
3251 | | // integer part. The magic number 450359963 is a good enough |
3252 | | // approximation of 2^(32 + 20) / 10^7; see |
3253 | | // https://jk-jeon.github.io/posts/2022/12/fixed-precision-formatting/#fixed-length-case |
3254 | | // for details. |
3255 | 41.0k | prod = ((subsegment * static_cast<uint64_t>(450359963)) >> 20) + 1; |
3256 | 41.0k | digits = static_cast<uint32_t>(prod >> 32); |
3257 | 41.0k | write2digits(buffer, digits); |
3258 | 41.0k | number_of_digits_printed += 2; |
3259 | 41.0k | } |
3260 | | |
3261 | | // Print all digit pairs. |
3262 | 256k | while (number_of_digits_printed < number_of_digits_to_print) { |
3263 | 174k | prod = static_cast<uint32_t>(prod) * static_cast<uint64_t>(100); |
3264 | 174k | digits = static_cast<uint32_t>(prod >> 32); |
3265 | 174k | write2digits(buffer + number_of_digits_printed, digits); |
3266 | 174k | number_of_digits_printed += 2; |
3267 | 174k | } |
3268 | 81.5k | }; |
3269 | | |
3270 | | // Print first subsegment. |
3271 | 66.9k | print_subsegment(first_subsegment, buf.data()); |
3272 | | |
3273 | | // Perform rounding if the first subsegment is the last subsegment to |
3274 | | // print. |
3275 | 66.9k | if (precision <= 9) { |
3276 | | // Rounding inside the subsegment. |
3277 | | // We round-up if: |
3278 | | // - either the fractional part is strictly larger than 1/2, or |
3279 | | // - the fractional part is exactly 1/2 and the last digit is odd. |
3280 | | // We rely on the following observations: |
3281 | | // - If fractional_part >= threshold, then the fractional part is |
3282 | | // strictly larger than 1/2. |
3283 | | // - If the MSB of fractional_part is set, then the fractional part |
3284 | | // must be at least 1/2. |
3285 | | // - When the MSB of fractional_part is set, either |
3286 | | // second_third_subsegments being nonzero or has_more_segments |
3287 | | // being true means there are further digits not printed, so the |
3288 | | // fractional part is strictly larger than 1/2. |
3289 | 52.3k | if (precision < 9) { |
3290 | 47.5k | uint32_t fractional_part = static_cast<uint32_t>(prod); |
3291 | 47.5k | should_round_up = |
3292 | 47.5k | fractional_part >= fractional_part_rounding_thresholds( |
3293 | 47.5k | 8 - number_of_digits_to_print) || |
3294 | 47.5k | ((fractional_part >> 31) & |
3295 | 26.8k | ((digits & 1) | (second_third_subsegments != 0) | |
3296 | 26.8k | has_more_segments)) != 0; |
3297 | 47.5k | } |
3298 | | // Rounding at the subsegment boundary. |
3299 | | // In this case, the fractional part is at least 1/2 if and only if |
3300 | | // second_third_subsegments >= 5000000000ULL, and is strictly larger |
3301 | | // than 1/2 if we further have either second_third_subsegments > |
3302 | | // 5000000000ULL or has_more_segments == true. |
3303 | 4.77k | else { |
3304 | 4.77k | should_round_up = second_third_subsegments > 5000000000ULL || |
3305 | 4.77k | (second_third_subsegments == 5000000000ULL && |
3306 | 3.43k | ((digits & 1) != 0 || has_more_segments)); |
3307 | 4.77k | } |
3308 | 52.3k | } |
3309 | | // Otherwise, print the second subsegment. |
3310 | 14.6k | else { |
3311 | | // Compilers are not aware of how to leverage the maximum value of |
3312 | | // second_third_subsegments to find out a better magic number which |
3313 | | // allows us to eliminate an additional shift. 1844674407370955162 = |
3314 | | // ceil(2^64/10) < ceil(2^64*(10^9/(10^10 - 1))). |
3315 | 14.6k | const uint32_t second_subsegment = |
3316 | 14.6k | static_cast<uint32_t>(dragonbox::umul128_upper64( |
3317 | 14.6k | second_third_subsegments, 1844674407370955162ULL)); |
3318 | 14.6k | const uint32_t third_subsegment = |
3319 | 14.6k | static_cast<uint32_t>(second_third_subsegments) - |
3320 | 14.6k | second_subsegment * 10; |
3321 | | |
3322 | 14.6k | number_of_digits_to_print = precision - 9; |
3323 | 14.6k | print_subsegment(second_subsegment, buf.data() + 9); |
3324 | | |
3325 | | // Rounding inside the subsegment. |
3326 | 14.6k | if (precision < 18) { |
3327 | | // The condition third_subsegment != 0 implies that the segment was |
3328 | | // of 19 digits, so in this case the third segment should be |
3329 | | // consisting of a genuine digit from the input. |
3330 | 11.3k | uint32_t fractional_part = static_cast<uint32_t>(prod); |
3331 | 11.3k | should_round_up = |
3332 | 11.3k | fractional_part >= fractional_part_rounding_thresholds( |
3333 | 11.3k | 8 - number_of_digits_to_print) || |
3334 | 11.3k | ((fractional_part >> 31) & |
3335 | 9.81k | ((digits & 1) | (third_subsegment != 0) | |
3336 | 9.81k | has_more_segments)) != 0; |
3337 | 11.3k | } |
3338 | | // Rounding at the subsegment boundary. |
3339 | 3.31k | else { |
3340 | | // In this case, the segment must be of 19 digits, thus |
3341 | | // the third subsegment should be consisting of a genuine digit from |
3342 | | // the input. |
3343 | 3.31k | should_round_up = third_subsegment > 5 || |
3344 | 3.31k | (third_subsegment == 5 && |
3345 | 2.46k | ((digits & 1) != 0 || has_more_segments)); |
3346 | 3.31k | } |
3347 | 14.6k | } |
3348 | | |
3349 | | // Round-up if necessary. |
3350 | 66.9k | if (should_round_up) { |
3351 | 26.9k | ++buf[precision - 1]; |
3352 | 38.1k | for (int i = precision - 1; i > 0 && buf[i] > '9'; --i) { |
3353 | 11.2k | buf[i] = '0'; |
3354 | 11.2k | ++buf[i - 1]; |
3355 | 11.2k | } |
3356 | 26.9k | if (buf[0] > '9') { |
3357 | 2.07k | buf[0] = '1'; |
3358 | 2.07k | if (fixed) |
3359 | 1.05k | buf[precision++] = '0'; |
3360 | 1.02k | else |
3361 | 1.02k | ++exp; |
3362 | 2.07k | } |
3363 | 26.9k | } |
3364 | 66.9k | buf.try_resize(to_unsigned(precision)); |
3365 | 66.9k | } |
3366 | 131k | } // if (digits_in_the_first_segment > precision) |
3367 | 17.6k | else { |
3368 | | // Adjust the exponent for its use in Dragon4. |
3369 | 17.6k | exp += digits_in_the_first_segment - 1; |
3370 | 17.6k | } |
3371 | 148k | } |
3372 | 245k | if (use_dragon) { |
3373 | 114k | auto f = basic_fp<uint128_t>(); |
3374 | 114k | bool is_predecessor_closer = binary32 ? f.assign(static_cast<float>(value)) |
3375 | 114k | : f.assign(converted_value); |
3376 | 114k | if (is_predecessor_closer) dragon_flags |= dragon::predecessor_closer; |
3377 | 114k | if (fixed) dragon_flags |= dragon::fixed; |
3378 | | // Limit precision to the maximum possible number of significant digits in |
3379 | | // an IEEE754 double because we don't need to generate zeros. |
3380 | 114k | const int max_double_digits = 767; |
3381 | 114k | if (precision > max_double_digits) precision = max_double_digits; |
3382 | 114k | format_dragon(f, dragon_flags, precision, buf, exp); |
3383 | 114k | } |
3384 | 245k | if (!fixed && !specs.alt()) { |
3385 | | // Remove trailing zeros. |
3386 | 80.0k | auto num_digits = buf.size(); |
3387 | 2.27M | while (num_digits > 0 && buf[num_digits - 1] == '0') { |
3388 | 2.19M | --num_digits; |
3389 | 2.19M | ++exp; |
3390 | 2.19M | } |
3391 | 80.0k | buf.try_resize(num_digits); |
3392 | 80.0k | } |
3393 | 245k | return exp; |
3394 | 276k | } int fmt::v11::detail::format_float<long double>(long double, int, fmt::v11::format_specs const&, bool, fmt::v11::detail::buffer<char>&) Line | Count | Source | 3100 | 108k | buffer<char>& buf) -> int { | 3101 | | // float is passed as double to reduce the number of instantiations. | 3102 | 108k | static_assert(!std::is_same<Float, float>::value, ""); | 3103 | 108k | auto converted_value = convert_float(value); | 3104 | | | 3105 | 108k | const bool fixed = specs.type() == presentation_type::fixed; | 3106 | 108k | if (value == 0) { | 3107 | 11.9k | if (precision <= 0 || !fixed) { | 3108 | 6.57k | buf.push_back('0'); | 3109 | 6.57k | return 0; | 3110 | 6.57k | } | 3111 | 5.40k | buf.try_resize(to_unsigned(precision)); | 3112 | 5.40k | fill_n(buf.data(), precision, '0'); | 3113 | 5.40k | return -precision; | 3114 | 11.9k | } | 3115 | | | 3116 | 96.8k | int exp = 0; | 3117 | 96.8k | bool use_dragon = true; | 3118 | 96.8k | unsigned dragon_flags = 0; | 3119 | 96.8k | if (!is_fast_float<Float>() || is_constant_evaluated()) { | 3120 | 96.8k | const auto inv_log2_10 = 0.3010299956639812; // 1 / log2(10) | 3121 | 96.8k | using info = dragonbox::float_info<decltype(converted_value)>; | 3122 | 96.8k | const auto f = basic_fp<typename info::carrier_uint>(converted_value); | 3123 | | // Compute exp, an approximate power of 10, such that | 3124 | | // 10^(exp - 1) <= value < 10^exp or 10^exp <= value < 10^(exp + 1). | 3125 | | // This is based on log10(value) == log2(value) / log2(10) and approximation | 3126 | | // of log2(value) by e + num_fraction_bits idea from double-conversion. | 3127 | 96.8k | auto e = (f.e + count_digits<1>(f.f) - 1) * inv_log2_10 - 1e-10; | 3128 | 96.8k | exp = static_cast<int>(e); | 3129 | 96.8k | if (e > exp) ++exp; // Compute ceil. | 3130 | 96.8k | dragon_flags = dragon::fixup; | 3131 | 96.8k | } else { | 3132 | | // Extract significand bits and exponent bits. | 3133 | 0 | using info = dragonbox::float_info<double>; | 3134 | 0 | auto br = bit_cast<uint64_t>(static_cast<double>(value)); | 3135 | |
| 3136 | 0 | const uint64_t significand_mask = | 3137 | 0 | (static_cast<uint64_t>(1) << num_significand_bits<double>()) - 1; | 3138 | 0 | uint64_t significand = (br & significand_mask); | 3139 | 0 | int exponent = static_cast<int>((br & exponent_mask<double>()) >> | 3140 | 0 | num_significand_bits<double>()); | 3141 | |
| 3142 | 0 | if (exponent != 0) { // Check if normal. | 3143 | 0 | exponent -= exponent_bias<double>() + num_significand_bits<double>(); | 3144 | 0 | significand |= | 3145 | 0 | (static_cast<uint64_t>(1) << num_significand_bits<double>()); | 3146 | 0 | significand <<= 1; | 3147 | 0 | } else { | 3148 | | // Normalize subnormal inputs. | 3149 | 0 | FMT_ASSERT(significand != 0, "zeros should not appear here"); | 3150 | 0 | int shift = countl_zero(significand); | 3151 | 0 | FMT_ASSERT(shift >= num_bits<uint64_t>() - num_significand_bits<double>(), | 3152 | 0 | ""); | 3153 | 0 | shift -= (num_bits<uint64_t>() - num_significand_bits<double>() - 2); | 3154 | 0 | exponent = (std::numeric_limits<double>::min_exponent - | 3155 | 0 | num_significand_bits<double>()) - | 3156 | 0 | shift; | 3157 | 0 | significand <<= shift; | 3158 | 0 | } | 3159 | | | 3160 | | // Compute the first several nonzero decimal significand digits. | 3161 | | // We call the number we get the first segment. | 3162 | 0 | const int k = info::kappa - dragonbox::floor_log10_pow2(exponent); | 3163 | 0 | exp = -k; | 3164 | 0 | const int beta = exponent + dragonbox::floor_log2_pow10(k); | 3165 | 0 | uint64_t first_segment; | 3166 | 0 | bool has_more_segments; | 3167 | 0 | int digits_in_the_first_segment; | 3168 | 0 | { | 3169 | 0 | const auto r = dragonbox::umul192_upper128( | 3170 | 0 | significand << beta, dragonbox::get_cached_power(k)); | 3171 | 0 | first_segment = r.high(); | 3172 | 0 | has_more_segments = r.low() != 0; | 3173 | | | 3174 | | // The first segment can have 18 ~ 19 digits. | 3175 | 0 | if (first_segment >= 1000000000000000000ULL) { | 3176 | 0 | digits_in_the_first_segment = 19; | 3177 | 0 | } else { | 3178 | | // When it is of 18-digits, we align it to 19-digits by adding a bogus | 3179 | | // zero at the end. | 3180 | 0 | digits_in_the_first_segment = 18; | 3181 | 0 | first_segment *= 10; | 3182 | 0 | } | 3183 | 0 | } | 3184 | | | 3185 | | // Compute the actual number of decimal digits to print. | 3186 | 0 | if (fixed) adjust_precision(precision, exp + digits_in_the_first_segment); | 3187 | | | 3188 | | // Use Dragon4 only when there might be not enough digits in the first | 3189 | | // segment. | 3190 | 0 | if (digits_in_the_first_segment > precision) { | 3191 | 0 | use_dragon = false; | 3192 | |
| 3193 | 0 | if (precision <= 0) { | 3194 | 0 | exp += digits_in_the_first_segment; | 3195 | |
| 3196 | 0 | if (precision < 0) { | 3197 | | // Nothing to do, since all we have are just leading zeros. | 3198 | 0 | buf.try_resize(0); | 3199 | 0 | } else { | 3200 | | // We may need to round-up. | 3201 | 0 | buf.try_resize(1); | 3202 | 0 | if ((first_segment | static_cast<uint64_t>(has_more_segments)) > | 3203 | 0 | 5000000000000000000ULL) { | 3204 | 0 | buf[0] = '1'; | 3205 | 0 | } else { | 3206 | 0 | buf[0] = '0'; | 3207 | 0 | } | 3208 | 0 | } | 3209 | 0 | } // precision <= 0 | 3210 | 0 | else { | 3211 | 0 | exp += digits_in_the_first_segment - precision; | 3212 | | | 3213 | | // When precision > 0, we divide the first segment into three | 3214 | | // subsegments, each with 9, 9, and 0 ~ 1 digits so that each fits | 3215 | | // in 32-bits which usually allows faster calculation than in | 3216 | | // 64-bits. Since some compiler (e.g. MSVC) doesn't know how to optimize | 3217 | | // division-by-constant for large 64-bit divisors, we do it here | 3218 | | // manually. The magic number 7922816251426433760 below is equal to | 3219 | | // ceil(2^(64+32) / 10^10). | 3220 | 0 | const uint32_t first_subsegment = static_cast<uint32_t>( | 3221 | 0 | dragonbox::umul128_upper64(first_segment, 7922816251426433760ULL) >> | 3222 | 0 | 32); | 3223 | 0 | const uint64_t second_third_subsegments = | 3224 | 0 | first_segment - first_subsegment * 10000000000ULL; | 3225 | |
| 3226 | 0 | uint64_t prod; | 3227 | 0 | uint32_t digits; | 3228 | 0 | bool should_round_up; | 3229 | 0 | int number_of_digits_to_print = min_of(precision, 9); | 3230 | | | 3231 | | // Print a 9-digits subsegment, either the first or the second. | 3232 | 0 | auto print_subsegment = [&](uint32_t subsegment, char* buffer) { | 3233 | 0 | int number_of_digits_printed = 0; | 3234 | | | 3235 | | // If we want to print an odd number of digits from the subsegment, | 3236 | 0 | if ((number_of_digits_to_print & 1) != 0) { | 3237 | | // Convert to 64-bit fixed-point fractional form with 1-digit | 3238 | | // integer part. The magic number 720575941 is a good enough | 3239 | | // approximation of 2^(32 + 24) / 10^8; see | 3240 | | // https://jk-jeon.github.io/posts/2022/12/fixed-precision-formatting/#fixed-length-case | 3241 | | // for details. | 3242 | 0 | prod = ((subsegment * static_cast<uint64_t>(720575941)) >> 24) + 1; | 3243 | 0 | digits = static_cast<uint32_t>(prod >> 32); | 3244 | 0 | *buffer = static_cast<char>('0' + digits); | 3245 | 0 | number_of_digits_printed++; | 3246 | 0 | } | 3247 | | // If we want to print an even number of digits from the | 3248 | | // first_subsegment, | 3249 | 0 | else { | 3250 | | // Convert to 64-bit fixed-point fractional form with 2-digits | 3251 | | // integer part. The magic number 450359963 is a good enough | 3252 | | // approximation of 2^(32 + 20) / 10^7; see | 3253 | | // https://jk-jeon.github.io/posts/2022/12/fixed-precision-formatting/#fixed-length-case | 3254 | | // for details. | 3255 | 0 | prod = ((subsegment * static_cast<uint64_t>(450359963)) >> 20) + 1; | 3256 | 0 | digits = static_cast<uint32_t>(prod >> 32); | 3257 | 0 | write2digits(buffer, digits); | 3258 | 0 | number_of_digits_printed += 2; | 3259 | 0 | } | 3260 | | | 3261 | | // Print all digit pairs. | 3262 | 0 | while (number_of_digits_printed < number_of_digits_to_print) { | 3263 | 0 | prod = static_cast<uint32_t>(prod) * static_cast<uint64_t>(100); | 3264 | 0 | digits = static_cast<uint32_t>(prod >> 32); | 3265 | 0 | write2digits(buffer + number_of_digits_printed, digits); | 3266 | 0 | number_of_digits_printed += 2; | 3267 | 0 | } | 3268 | 0 | }; | 3269 | | | 3270 | | // Print first subsegment. | 3271 | 0 | print_subsegment(first_subsegment, buf.data()); | 3272 | | | 3273 | | // Perform rounding if the first subsegment is the last subsegment to | 3274 | | // print. | 3275 | 0 | if (precision <= 9) { | 3276 | | // Rounding inside the subsegment. | 3277 | | // We round-up if: | 3278 | | // - either the fractional part is strictly larger than 1/2, or | 3279 | | // - the fractional part is exactly 1/2 and the last digit is odd. | 3280 | | // We rely on the following observations: | 3281 | | // - If fractional_part >= threshold, then the fractional part is | 3282 | | // strictly larger than 1/2. | 3283 | | // - If the MSB of fractional_part is set, then the fractional part | 3284 | | // must be at least 1/2. | 3285 | | // - When the MSB of fractional_part is set, either | 3286 | | // second_third_subsegments being nonzero or has_more_segments | 3287 | | // being true means there are further digits not printed, so the | 3288 | | // fractional part is strictly larger than 1/2. | 3289 | 0 | if (precision < 9) { | 3290 | 0 | uint32_t fractional_part = static_cast<uint32_t>(prod); | 3291 | 0 | should_round_up = | 3292 | 0 | fractional_part >= fractional_part_rounding_thresholds( | 3293 | 0 | 8 - number_of_digits_to_print) || | 3294 | 0 | ((fractional_part >> 31) & | 3295 | 0 | ((digits & 1) | (second_third_subsegments != 0) | | 3296 | 0 | has_more_segments)) != 0; | 3297 | 0 | } | 3298 | | // Rounding at the subsegment boundary. | 3299 | | // In this case, the fractional part is at least 1/2 if and only if | 3300 | | // second_third_subsegments >= 5000000000ULL, and is strictly larger | 3301 | | // than 1/2 if we further have either second_third_subsegments > | 3302 | | // 5000000000ULL or has_more_segments == true. | 3303 | 0 | else { | 3304 | 0 | should_round_up = second_third_subsegments > 5000000000ULL || | 3305 | 0 | (second_third_subsegments == 5000000000ULL && | 3306 | 0 | ((digits & 1) != 0 || has_more_segments)); | 3307 | 0 | } | 3308 | 0 | } | 3309 | | // Otherwise, print the second subsegment. | 3310 | 0 | else { | 3311 | | // Compilers are not aware of how to leverage the maximum value of | 3312 | | // second_third_subsegments to find out a better magic number which | 3313 | | // allows us to eliminate an additional shift. 1844674407370955162 = | 3314 | | // ceil(2^64/10) < ceil(2^64*(10^9/(10^10 - 1))). | 3315 | 0 | const uint32_t second_subsegment = | 3316 | 0 | static_cast<uint32_t>(dragonbox::umul128_upper64( | 3317 | 0 | second_third_subsegments, 1844674407370955162ULL)); | 3318 | 0 | const uint32_t third_subsegment = | 3319 | 0 | static_cast<uint32_t>(second_third_subsegments) - | 3320 | 0 | second_subsegment * 10; | 3321 | |
| 3322 | 0 | number_of_digits_to_print = precision - 9; | 3323 | 0 | print_subsegment(second_subsegment, buf.data() + 9); | 3324 | | | 3325 | | // Rounding inside the subsegment. | 3326 | 0 | if (precision < 18) { | 3327 | | // The condition third_subsegment != 0 implies that the segment was | 3328 | | // of 19 digits, so in this case the third segment should be | 3329 | | // consisting of a genuine digit from the input. | 3330 | 0 | uint32_t fractional_part = static_cast<uint32_t>(prod); | 3331 | 0 | should_round_up = | 3332 | 0 | fractional_part >= fractional_part_rounding_thresholds( | 3333 | 0 | 8 - number_of_digits_to_print) || | 3334 | 0 | ((fractional_part >> 31) & | 3335 | 0 | ((digits & 1) | (third_subsegment != 0) | | 3336 | 0 | has_more_segments)) != 0; | 3337 | 0 | } | 3338 | | // Rounding at the subsegment boundary. | 3339 | 0 | else { | 3340 | | // In this case, the segment must be of 19 digits, thus | 3341 | | // the third subsegment should be consisting of a genuine digit from | 3342 | | // the input. | 3343 | 0 | should_round_up = third_subsegment > 5 || | 3344 | 0 | (third_subsegment == 5 && | 3345 | 0 | ((digits & 1) != 0 || has_more_segments)); | 3346 | 0 | } | 3347 | 0 | } | 3348 | | | 3349 | | // Round-up if necessary. | 3350 | 0 | if (should_round_up) { | 3351 | 0 | ++buf[precision - 1]; | 3352 | 0 | for (int i = precision - 1; i > 0 && buf[i] > '9'; --i) { | 3353 | 0 | buf[i] = '0'; | 3354 | 0 | ++buf[i - 1]; | 3355 | 0 | } | 3356 | 0 | if (buf[0] > '9') { | 3357 | 0 | buf[0] = '1'; | 3358 | 0 | if (fixed) | 3359 | 0 | buf[precision++] = '0'; | 3360 | 0 | else | 3361 | 0 | ++exp; | 3362 | 0 | } | 3363 | 0 | } | 3364 | 0 | buf.try_resize(to_unsigned(precision)); | 3365 | 0 | } | 3366 | 0 | } // if (digits_in_the_first_segment > precision) | 3367 | 0 | else { | 3368 | | // Adjust the exponent for its use in Dragon4. | 3369 | 0 | exp += digits_in_the_first_segment - 1; | 3370 | 0 | } | 3371 | 0 | } | 3372 | 96.8k | if (use_dragon) { | 3373 | 96.8k | auto f = basic_fp<uint128_t>(); | 3374 | 96.8k | bool is_predecessor_closer = binary32 ? f.assign(static_cast<float>(value)) | 3375 | 96.8k | : f.assign(converted_value); | 3376 | 96.8k | if (is_predecessor_closer) dragon_flags |= dragon::predecessor_closer; | 3377 | 96.8k | if (fixed) dragon_flags |= dragon::fixed; | 3378 | | // Limit precision to the maximum possible number of significant digits in | 3379 | | // an IEEE754 double because we don't need to generate zeros. | 3380 | 96.8k | const int max_double_digits = 767; | 3381 | 96.8k | if (precision > max_double_digits) precision = max_double_digits; | 3382 | 96.8k | format_dragon(f, dragon_flags, precision, buf, exp); | 3383 | 96.8k | } | 3384 | 96.8k | if (!fixed && !specs.alt()) { | 3385 | | // Remove trailing zeros. | 3386 | 44.0k | auto num_digits = buf.size(); | 3387 | 577k | while (num_digits > 0 && buf[num_digits - 1] == '0') { | 3388 | 533k | --num_digits; | 3389 | 533k | ++exp; | 3390 | 533k | } | 3391 | 44.0k | buf.try_resize(num_digits); | 3392 | 44.0k | } | 3393 | 96.8k | return exp; | 3394 | 108k | } |
int fmt::v11::detail::format_float<double>(double, int, fmt::v11::format_specs const&, bool, fmt::v11::detail::buffer<char>&) Line | Count | Source | 3100 | 168k | buffer<char>& buf) -> int { | 3101 | | // float is passed as double to reduce the number of instantiations. | 3102 | 168k | static_assert(!std::is_same<Float, float>::value, ""); | 3103 | 168k | auto converted_value = convert_float(value); | 3104 | | | 3105 | 168k | const bool fixed = specs.type() == presentation_type::fixed; | 3106 | 168k | if (value == 0) { | 3107 | 19.3k | if (precision <= 0 || !fixed) { | 3108 | 7.59k | buf.push_back('0'); | 3109 | 7.59k | return 0; | 3110 | 7.59k | } | 3111 | 11.7k | buf.try_resize(to_unsigned(precision)); | 3112 | 11.7k | fill_n(buf.data(), precision, '0'); | 3113 | 11.7k | return -precision; | 3114 | 19.3k | } | 3115 | | | 3116 | 148k | int exp = 0; | 3117 | 148k | bool use_dragon = true; | 3118 | 148k | unsigned dragon_flags = 0; | 3119 | 148k | if (!is_fast_float<Float>() || is_constant_evaluated()) { | 3120 | 0 | const auto inv_log2_10 = 0.3010299956639812; // 1 / log2(10) | 3121 | 0 | using info = dragonbox::float_info<decltype(converted_value)>; | 3122 | 0 | const auto f = basic_fp<typename info::carrier_uint>(converted_value); | 3123 | | // Compute exp, an approximate power of 10, such that | 3124 | | // 10^(exp - 1) <= value < 10^exp or 10^exp <= value < 10^(exp + 1). | 3125 | | // This is based on log10(value) == log2(value) / log2(10) and approximation | 3126 | | // of log2(value) by e + num_fraction_bits idea from double-conversion. | 3127 | 0 | auto e = (f.e + count_digits<1>(f.f) - 1) * inv_log2_10 - 1e-10; | 3128 | 0 | exp = static_cast<int>(e); | 3129 | 0 | if (e > exp) ++exp; // Compute ceil. | 3130 | 0 | dragon_flags = dragon::fixup; | 3131 | 148k | } else { | 3132 | | // Extract significand bits and exponent bits. | 3133 | 148k | using info = dragonbox::float_info<double>; | 3134 | 148k | auto br = bit_cast<uint64_t>(static_cast<double>(value)); | 3135 | | | 3136 | 148k | const uint64_t significand_mask = | 3137 | 148k | (static_cast<uint64_t>(1) << num_significand_bits<double>()) - 1; | 3138 | 148k | uint64_t significand = (br & significand_mask); | 3139 | 148k | int exponent = static_cast<int>((br & exponent_mask<double>()) >> | 3140 | 148k | num_significand_bits<double>()); | 3141 | | | 3142 | 148k | if (exponent != 0) { // Check if normal. | 3143 | 135k | exponent -= exponent_bias<double>() + num_significand_bits<double>(); | 3144 | 135k | significand |= | 3145 | 135k | (static_cast<uint64_t>(1) << num_significand_bits<double>()); | 3146 | 135k | significand <<= 1; | 3147 | 135k | } else { | 3148 | | // Normalize subnormal inputs. | 3149 | 13.2k | FMT_ASSERT(significand != 0, "zeros should not appear here"); | 3150 | 13.2k | int shift = countl_zero(significand); | 3151 | 13.2k | FMT_ASSERT(shift >= num_bits<uint64_t>() - num_significand_bits<double>(), | 3152 | 13.2k | ""); | 3153 | 13.2k | shift -= (num_bits<uint64_t>() - num_significand_bits<double>() - 2); | 3154 | 13.2k | exponent = (std::numeric_limits<double>::min_exponent - | 3155 | 13.2k | num_significand_bits<double>()) - | 3156 | 13.2k | shift; | 3157 | 13.2k | significand <<= shift; | 3158 | 13.2k | } | 3159 | | | 3160 | | // Compute the first several nonzero decimal significand digits. | 3161 | | // We call the number we get the first segment. | 3162 | 148k | const int k = info::kappa - dragonbox::floor_log10_pow2(exponent); | 3163 | 148k | exp = -k; | 3164 | 148k | const int beta = exponent + dragonbox::floor_log2_pow10(k); | 3165 | 148k | uint64_t first_segment; | 3166 | 148k | bool has_more_segments; | 3167 | 148k | int digits_in_the_first_segment; | 3168 | 148k | { | 3169 | 148k | const auto r = dragonbox::umul192_upper128( | 3170 | 148k | significand << beta, dragonbox::get_cached_power(k)); | 3171 | 148k | first_segment = r.high(); | 3172 | 148k | has_more_segments = r.low() != 0; | 3173 | | | 3174 | | // The first segment can have 18 ~ 19 digits. | 3175 | 148k | if (first_segment >= 1000000000000000000ULL) { | 3176 | 113k | digits_in_the_first_segment = 19; | 3177 | 113k | } else { | 3178 | | // When it is of 18-digits, we align it to 19-digits by adding a bogus | 3179 | | // zero at the end. | 3180 | 35.1k | digits_in_the_first_segment = 18; | 3181 | 35.1k | first_segment *= 10; | 3182 | 35.1k | } | 3183 | 148k | } | 3184 | | | 3185 | | // Compute the actual number of decimal digits to print. | 3186 | 148k | if (fixed) adjust_precision(precision, exp + digits_in_the_first_segment); | 3187 | | | 3188 | | // Use Dragon4 only when there might be not enough digits in the first | 3189 | | // segment. | 3190 | 148k | if (digits_in_the_first_segment > precision) { | 3191 | 131k | use_dragon = false; | 3192 | | | 3193 | 131k | if (precision <= 0) { | 3194 | 64.1k | exp += digits_in_the_first_segment; | 3195 | | | 3196 | 64.1k | if (precision < 0) { | 3197 | | // Nothing to do, since all we have are just leading zeros. | 3198 | 62.0k | buf.try_resize(0); | 3199 | 62.0k | } else { | 3200 | | // We may need to round-up. | 3201 | 2.08k | buf.try_resize(1); | 3202 | 2.08k | if ((first_segment | static_cast<uint64_t>(has_more_segments)) > | 3203 | 2.08k | 5000000000000000000ULL) { | 3204 | 793 | buf[0] = '1'; | 3205 | 1.29k | } else { | 3206 | 1.29k | buf[0] = '0'; | 3207 | 1.29k | } | 3208 | 2.08k | } | 3209 | 64.1k | } // precision <= 0 | 3210 | 66.9k | else { | 3211 | 66.9k | exp += digits_in_the_first_segment - precision; | 3212 | | | 3213 | | // When precision > 0, we divide the first segment into three | 3214 | | // subsegments, each with 9, 9, and 0 ~ 1 digits so that each fits | 3215 | | // in 32-bits which usually allows faster calculation than in | 3216 | | // 64-bits. Since some compiler (e.g. MSVC) doesn't know how to optimize | 3217 | | // division-by-constant for large 64-bit divisors, we do it here | 3218 | | // manually. The magic number 7922816251426433760 below is equal to | 3219 | | // ceil(2^(64+32) / 10^10). | 3220 | 66.9k | const uint32_t first_subsegment = static_cast<uint32_t>( | 3221 | 66.9k | dragonbox::umul128_upper64(first_segment, 7922816251426433760ULL) >> | 3222 | 66.9k | 32); | 3223 | 66.9k | const uint64_t second_third_subsegments = | 3224 | 66.9k | first_segment - first_subsegment * 10000000000ULL; | 3225 | | | 3226 | 66.9k | uint64_t prod; | 3227 | 66.9k | uint32_t digits; | 3228 | 66.9k | bool should_round_up; | 3229 | 66.9k | int number_of_digits_to_print = min_of(precision, 9); | 3230 | | | 3231 | | // Print a 9-digits subsegment, either the first or the second. | 3232 | 66.9k | auto print_subsegment = [&](uint32_t subsegment, char* buffer) { | 3233 | 66.9k | int number_of_digits_printed = 0; | 3234 | | | 3235 | | // If we want to print an odd number of digits from the subsegment, | 3236 | 66.9k | if ((number_of_digits_to_print & 1) != 0) { | 3237 | | // Convert to 64-bit fixed-point fractional form with 1-digit | 3238 | | // integer part. The magic number 720575941 is a good enough | 3239 | | // approximation of 2^(32 + 24) / 10^8; see | 3240 | | // https://jk-jeon.github.io/posts/2022/12/fixed-precision-formatting/#fixed-length-case | 3241 | | // for details. | 3242 | 66.9k | prod = ((subsegment * static_cast<uint64_t>(720575941)) >> 24) + 1; | 3243 | 66.9k | digits = static_cast<uint32_t>(prod >> 32); | 3244 | 66.9k | *buffer = static_cast<char>('0' + digits); | 3245 | 66.9k | number_of_digits_printed++; | 3246 | 66.9k | } | 3247 | | // If we want to print an even number of digits from the | 3248 | | // first_subsegment, | 3249 | 66.9k | else { | 3250 | | // Convert to 64-bit fixed-point fractional form with 2-digits | 3251 | | // integer part. The magic number 450359963 is a good enough | 3252 | | // approximation of 2^(32 + 20) / 10^7; see | 3253 | | // https://jk-jeon.github.io/posts/2022/12/fixed-precision-formatting/#fixed-length-case | 3254 | | // for details. | 3255 | 66.9k | prod = ((subsegment * static_cast<uint64_t>(450359963)) >> 20) + 1; | 3256 | 66.9k | digits = static_cast<uint32_t>(prod >> 32); | 3257 | 66.9k | write2digits(buffer, digits); | 3258 | 66.9k | number_of_digits_printed += 2; | 3259 | 66.9k | } | 3260 | | | 3261 | | // Print all digit pairs. | 3262 | 66.9k | while (number_of_digits_printed < number_of_digits_to_print) { | 3263 | 66.9k | prod = static_cast<uint32_t>(prod) * static_cast<uint64_t>(100); | 3264 | 66.9k | digits = static_cast<uint32_t>(prod >> 32); | 3265 | 66.9k | write2digits(buffer + number_of_digits_printed, digits); | 3266 | 66.9k | number_of_digits_printed += 2; | 3267 | 66.9k | } | 3268 | 66.9k | }; | 3269 | | | 3270 | | // Print first subsegment. | 3271 | 66.9k | print_subsegment(first_subsegment, buf.data()); | 3272 | | | 3273 | | // Perform rounding if the first subsegment is the last subsegment to | 3274 | | // print. | 3275 | 66.9k | if (precision <= 9) { | 3276 | | // Rounding inside the subsegment. | 3277 | | // We round-up if: | 3278 | | // - either the fractional part is strictly larger than 1/2, or | 3279 | | // - the fractional part is exactly 1/2 and the last digit is odd. | 3280 | | // We rely on the following observations: | 3281 | | // - If fractional_part >= threshold, then the fractional part is | 3282 | | // strictly larger than 1/2. | 3283 | | // - If the MSB of fractional_part is set, then the fractional part | 3284 | | // must be at least 1/2. | 3285 | | // - When the MSB of fractional_part is set, either | 3286 | | // second_third_subsegments being nonzero or has_more_segments | 3287 | | // being true means there are further digits not printed, so the | 3288 | | // fractional part is strictly larger than 1/2. | 3289 | 52.3k | if (precision < 9) { | 3290 | 47.5k | uint32_t fractional_part = static_cast<uint32_t>(prod); | 3291 | 47.5k | should_round_up = | 3292 | 47.5k | fractional_part >= fractional_part_rounding_thresholds( | 3293 | 47.5k | 8 - number_of_digits_to_print) || | 3294 | 47.5k | ((fractional_part >> 31) & | 3295 | 26.8k | ((digits & 1) | (second_third_subsegments != 0) | | 3296 | 26.8k | has_more_segments)) != 0; | 3297 | 47.5k | } | 3298 | | // Rounding at the subsegment boundary. | 3299 | | // In this case, the fractional part is at least 1/2 if and only if | 3300 | | // second_third_subsegments >= 5000000000ULL, and is strictly larger | 3301 | | // than 1/2 if we further have either second_third_subsegments > | 3302 | | // 5000000000ULL or has_more_segments == true. | 3303 | 4.77k | else { | 3304 | 4.77k | should_round_up = second_third_subsegments > 5000000000ULL || | 3305 | 4.77k | (second_third_subsegments == 5000000000ULL && | 3306 | 3.43k | ((digits & 1) != 0 || has_more_segments)); | 3307 | 4.77k | } | 3308 | 52.3k | } | 3309 | | // Otherwise, print the second subsegment. | 3310 | 14.6k | else { | 3311 | | // Compilers are not aware of how to leverage the maximum value of | 3312 | | // second_third_subsegments to find out a better magic number which | 3313 | | // allows us to eliminate an additional shift. 1844674407370955162 = | 3314 | | // ceil(2^64/10) < ceil(2^64*(10^9/(10^10 - 1))). | 3315 | 14.6k | const uint32_t second_subsegment = | 3316 | 14.6k | static_cast<uint32_t>(dragonbox::umul128_upper64( | 3317 | 14.6k | second_third_subsegments, 1844674407370955162ULL)); | 3318 | 14.6k | const uint32_t third_subsegment = | 3319 | 14.6k | static_cast<uint32_t>(second_third_subsegments) - | 3320 | 14.6k | second_subsegment * 10; | 3321 | | | 3322 | 14.6k | number_of_digits_to_print = precision - 9; | 3323 | 14.6k | print_subsegment(second_subsegment, buf.data() + 9); | 3324 | | | 3325 | | // Rounding inside the subsegment. | 3326 | 14.6k | if (precision < 18) { | 3327 | | // The condition third_subsegment != 0 implies that the segment was | 3328 | | // of 19 digits, so in this case the third segment should be | 3329 | | // consisting of a genuine digit from the input. | 3330 | 11.3k | uint32_t fractional_part = static_cast<uint32_t>(prod); | 3331 | 11.3k | should_round_up = | 3332 | 11.3k | fractional_part >= fractional_part_rounding_thresholds( | 3333 | 11.3k | 8 - number_of_digits_to_print) || | 3334 | 11.3k | ((fractional_part >> 31) & | 3335 | 9.81k | ((digits & 1) | (third_subsegment != 0) | | 3336 | 9.81k | has_more_segments)) != 0; | 3337 | 11.3k | } | 3338 | | // Rounding at the subsegment boundary. | 3339 | 3.31k | else { | 3340 | | // In this case, the segment must be of 19 digits, thus | 3341 | | // the third subsegment should be consisting of a genuine digit from | 3342 | | // the input. | 3343 | 3.31k | should_round_up = third_subsegment > 5 || | 3344 | 3.31k | (third_subsegment == 5 && | 3345 | 2.46k | ((digits & 1) != 0 || has_more_segments)); | 3346 | 3.31k | } | 3347 | 14.6k | } | 3348 | | | 3349 | | // Round-up if necessary. | 3350 | 66.9k | if (should_round_up) { | 3351 | 26.9k | ++buf[precision - 1]; | 3352 | 38.1k | for (int i = precision - 1; i > 0 && buf[i] > '9'; --i) { | 3353 | 11.2k | buf[i] = '0'; | 3354 | 11.2k | ++buf[i - 1]; | 3355 | 11.2k | } | 3356 | 26.9k | if (buf[0] > '9') { | 3357 | 2.07k | buf[0] = '1'; | 3358 | 2.07k | if (fixed) | 3359 | 1.05k | buf[precision++] = '0'; | 3360 | 1.02k | else | 3361 | 1.02k | ++exp; | 3362 | 2.07k | } | 3363 | 26.9k | } | 3364 | 66.9k | buf.try_resize(to_unsigned(precision)); | 3365 | 66.9k | } | 3366 | 131k | } // if (digits_in_the_first_segment > precision) | 3367 | 17.6k | else { | 3368 | | // Adjust the exponent for its use in Dragon4. | 3369 | 17.6k | exp += digits_in_the_first_segment - 1; | 3370 | 17.6k | } | 3371 | 148k | } | 3372 | 148k | if (use_dragon) { | 3373 | 17.6k | auto f = basic_fp<uint128_t>(); | 3374 | 17.6k | bool is_predecessor_closer = binary32 ? f.assign(static_cast<float>(value)) | 3375 | 17.6k | : f.assign(converted_value); | 3376 | 17.6k | if (is_predecessor_closer) dragon_flags |= dragon::predecessor_closer; | 3377 | 17.6k | if (fixed) dragon_flags |= dragon::fixed; | 3378 | | // Limit precision to the maximum possible number of significant digits in | 3379 | | // an IEEE754 double because we don't need to generate zeros. | 3380 | 17.6k | const int max_double_digits = 767; | 3381 | 17.6k | if (precision > max_double_digits) precision = max_double_digits; | 3382 | 17.6k | format_dragon(f, dragon_flags, precision, buf, exp); | 3383 | 17.6k | } | 3384 | 148k | if (!fixed && !specs.alt()) { | 3385 | | // Remove trailing zeros. | 3386 | 35.9k | auto num_digits = buf.size(); | 3387 | 1.69M | while (num_digits > 0 && buf[num_digits - 1] == '0') { | 3388 | 1.65M | --num_digits; | 3389 | 1.65M | ++exp; | 3390 | 1.65M | } | 3391 | 35.9k | buf.try_resize(num_digits); | 3392 | 35.9k | } | 3393 | 148k | return exp; | 3394 | 168k | } |
|
3395 | | |
3396 | | template <typename Char, typename OutputIt, typename T> |
3397 | | FMT_CONSTEXPR20 auto write_float(OutputIt out, T value, format_specs specs, |
3398 | 353k | locale_ref loc) -> OutputIt { |
3399 | | // Use signbit because value < 0 is false for NaN. |
3400 | 353k | sign s = detail::signbit(value) ? sign::minus : specs.sign(); |
3401 | | |
3402 | 353k | if (!detail::isfinite(value)) |
3403 | 29.7k | return write_nonfinite<Char>(out, detail::isnan(value), specs, s); |
3404 | | |
3405 | 323k | if (specs.align() == align::numeric && s != sign::none) { |
3406 | 6.89k | *out++ = detail::getsign<Char>(s); |
3407 | 6.89k | s = sign::none; |
3408 | 6.89k | if (specs.width != 0) --specs.width; |
3409 | 6.89k | } |
3410 | | |
3411 | 323k | int precision = specs.precision; |
3412 | 323k | if (precision < 0) { |
3413 | 139k | if (specs.type() != presentation_type::none) { |
3414 | 76.2k | precision = 6; |
3415 | 76.2k | } else if (is_fast_float<T>::value && !is_constant_evaluated()) { |
3416 | | // Use Dragonbox for the shortest format. |
3417 | 32.6k | using floaty = conditional_t<sizeof(T) >= sizeof(double), double, float>; |
3418 | 32.6k | auto dec = dragonbox::to_decimal(static_cast<floaty>(value)); |
3419 | 32.6k | return write_float<Char>(out, dec, specs, s, loc); |
3420 | 32.6k | } |
3421 | 139k | } |
3422 | | |
3423 | 290k | memory_buffer buffer; |
3424 | 290k | if (specs.type() == presentation_type::hexfloat) { |
3425 | 13.7k | if (s != sign::none) buffer.push_back(detail::getsign<char>(s)); |
3426 | 13.7k | format_hexfloat(convert_float(value), specs, buffer); |
3427 | 13.7k | return write_bytes<Char, align::right>(out, {buffer.data(), buffer.size()}, |
3428 | 13.7k | specs); |
3429 | 13.7k | } |
3430 | | |
3431 | 276k | if (specs.type() == presentation_type::exp) { |
3432 | 6.54k | if (precision == max_value<int>()) |
3433 | 9 | report_error("number is too big"); |
3434 | 6.53k | else |
3435 | 6.53k | ++precision; |
3436 | 6.54k | if (specs.precision != 0) specs.set_alt(); |
3437 | 270k | } else if (specs.type() == presentation_type::fixed) { |
3438 | 184k | if (specs.precision != 0) specs.set_alt(); |
3439 | 184k | } else if (precision == 0) { |
3440 | 2.17k | precision = 1; |
3441 | 2.17k | } |
3442 | 276k | int exp = format_float(convert_float(value), precision, specs, |
3443 | 276k | std::is_same<T, float>(), buffer); |
3444 | | |
3445 | 276k | specs.precision = precision; |
3446 | 276k | auto f = big_decimal_fp{buffer.data(), static_cast<int>(buffer.size()), exp}; |
3447 | 276k | return write_float<Char>(out, f, specs, s, loc); |
3448 | 290k | } fmt::v11::basic_appender<char> fmt::v11::detail::write_float<char, fmt::v11::basic_appender<char>, long double>(fmt::v11::basic_appender<char>, long double, fmt::v11::format_specs, fmt::v11::detail::locale_ref) Line | Count | Source | 3398 | 128k | locale_ref loc) -> OutputIt { | 3399 | | // Use signbit because value < 0 is false for NaN. | 3400 | 128k | sign s = detail::signbit(value) ? sign::minus : specs.sign(); | 3401 | | | 3402 | 128k | if (!detail::isfinite(value)) | 3403 | 13.5k | return write_nonfinite<Char>(out, detail::isnan(value), specs, s); | 3404 | | | 3405 | 114k | if (specs.align() == align::numeric && s != sign::none) { | 3406 | 1.88k | *out++ = detail::getsign<Char>(s); | 3407 | 1.88k | s = sign::none; | 3408 | 1.88k | if (specs.width != 0) --specs.width; | 3409 | 1.88k | } | 3410 | | | 3411 | 114k | int precision = specs.precision; | 3412 | 114k | if (precision < 0) { | 3413 | 54.9k | if (specs.type() != presentation_type::none) { | 3414 | 24.3k | precision = 6; | 3415 | 30.6k | } else if (is_fast_float<T>::value && !is_constant_evaluated()) { | 3416 | | // Use Dragonbox for the shortest format. | 3417 | 0 | using floaty = conditional_t<sizeof(T) >= sizeof(double), double, float>; | 3418 | 0 | auto dec = dragonbox::to_decimal(static_cast<floaty>(value)); | 3419 | 0 | return write_float<Char>(out, dec, specs, s, loc); | 3420 | 0 | } | 3421 | 54.9k | } | 3422 | | | 3423 | 114k | memory_buffer buffer; | 3424 | 114k | if (specs.type() == presentation_type::hexfloat) { | 3425 | 5.71k | if (s != sign::none) buffer.push_back(detail::getsign<char>(s)); | 3426 | 5.71k | format_hexfloat(convert_float(value), specs, buffer); | 3427 | 5.71k | return write_bytes<Char, align::right>(out, {buffer.data(), buffer.size()}, | 3428 | 5.71k | specs); | 3429 | 5.71k | } | 3430 | | | 3431 | 108k | if (specs.type() == presentation_type::exp) { | 3432 | 2.75k | if (precision == max_value<int>()) | 3433 | 3 | report_error("number is too big"); | 3434 | 2.75k | else | 3435 | 2.75k | ++precision; | 3436 | 2.75k | if (specs.precision != 0) specs.set_alt(); | 3437 | 106k | } else if (specs.type() == presentation_type::fixed) { | 3438 | 57.9k | if (specs.precision != 0) specs.set_alt(); | 3439 | 57.9k | } else if (precision == 0) { | 3440 | 643 | precision = 1; | 3441 | 643 | } | 3442 | 108k | int exp = format_float(convert_float(value), precision, specs, | 3443 | 108k | std::is_same<T, float>(), buffer); | 3444 | | | 3445 | 108k | specs.precision = precision; | 3446 | 108k | auto f = big_decimal_fp{buffer.data(), static_cast<int>(buffer.size()), exp}; | 3447 | 108k | return write_float<Char>(out, f, specs, s, loc); | 3448 | 114k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_float<char, fmt::v11::basic_appender<char>, float>(fmt::v11::basic_appender<char>, float, fmt::v11::format_specs, fmt::v11::detail::locale_ref) Line | Count | Source | 3398 | 110k | locale_ref loc) -> OutputIt { | 3399 | | // Use signbit because value < 0 is false for NaN. | 3400 | 110k | sign s = detail::signbit(value) ? sign::minus : specs.sign(); | 3401 | | | 3402 | 110k | if (!detail::isfinite(value)) | 3403 | 7.82k | return write_nonfinite<Char>(out, detail::isnan(value), specs, s); | 3404 | | | 3405 | 102k | if (specs.align() == align::numeric && s != sign::none) { | 3406 | 2.97k | *out++ = detail::getsign<Char>(s); | 3407 | 2.97k | s = sign::none; | 3408 | 2.97k | if (specs.width != 0) --specs.width; | 3409 | 2.97k | } | 3410 | | | 3411 | 102k | int precision = specs.precision; | 3412 | 102k | if (precision < 0) { | 3413 | 42.3k | if (specs.type() != presentation_type::none) { | 3414 | 25.8k | precision = 6; | 3415 | 25.8k | } else if (is_fast_float<T>::value && !is_constant_evaluated()) { | 3416 | | // Use Dragonbox for the shortest format. | 3417 | 16.4k | using floaty = conditional_t<sizeof(T) >= sizeof(double), double, float>; | 3418 | 16.4k | auto dec = dragonbox::to_decimal(static_cast<floaty>(value)); | 3419 | 16.4k | return write_float<Char>(out, dec, specs, s, loc); | 3420 | 16.4k | } | 3421 | 42.3k | } | 3422 | | | 3423 | 86.4k | memory_buffer buffer; | 3424 | 86.4k | if (specs.type() == presentation_type::hexfloat) { | 3425 | 3.89k | if (s != sign::none) buffer.push_back(detail::getsign<char>(s)); | 3426 | 3.89k | format_hexfloat(convert_float(value), specs, buffer); | 3427 | 3.89k | return write_bytes<Char, align::right>(out, {buffer.data(), buffer.size()}, | 3428 | 3.89k | specs); | 3429 | 3.89k | } | 3430 | | | 3431 | 82.5k | if (specs.type() == presentation_type::exp) { | 3432 | 1.74k | if (precision == max_value<int>()) | 3433 | 3 | report_error("number is too big"); | 3434 | 1.74k | else | 3435 | 1.74k | ++precision; | 3436 | 1.74k | if (specs.precision != 0) specs.set_alt(); | 3437 | 80.8k | } else if (specs.type() == presentation_type::fixed) { | 3438 | 62.3k | if (specs.precision != 0) specs.set_alt(); | 3439 | 62.3k | } else if (precision == 0) { | 3440 | 689 | precision = 1; | 3441 | 689 | } | 3442 | 82.5k | int exp = format_float(convert_float(value), precision, specs, | 3443 | 82.5k | std::is_same<T, float>(), buffer); | 3444 | | | 3445 | 82.5k | specs.precision = precision; | 3446 | 82.5k | auto f = big_decimal_fp{buffer.data(), static_cast<int>(buffer.size()), exp}; | 3447 | 82.5k | return write_float<Char>(out, f, specs, s, loc); | 3448 | 86.4k | } |
fmt::v11::basic_appender<char> fmt::v11::detail::write_float<char, fmt::v11::basic_appender<char>, double>(fmt::v11::basic_appender<char>, double, fmt::v11::format_specs, fmt::v11::detail::locale_ref) Line | Count | Source | 3398 | 114k | locale_ref loc) -> OutputIt { | 3399 | | // Use signbit because value < 0 is false for NaN. | 3400 | 114k | sign s = detail::signbit(value) ? sign::minus : specs.sign(); | 3401 | | | 3402 | 114k | if (!detail::isfinite(value)) | 3403 | 8.39k | return write_nonfinite<Char>(out, detail::isnan(value), specs, s); | 3404 | | | 3405 | 105k | if (specs.align() == align::numeric && s != sign::none) { | 3406 | 2.03k | *out++ = detail::getsign<Char>(s); | 3407 | 2.03k | s = sign::none; | 3408 | 2.03k | if (specs.width != 0) --specs.width; | 3409 | 2.03k | } | 3410 | | | 3411 | 105k | int precision = specs.precision; | 3412 | 105k | if (precision < 0) { | 3413 | 42.2k | if (specs.type() != presentation_type::none) { | 3414 | 26.0k | precision = 6; | 3415 | 26.0k | } else if (is_fast_float<T>::value && !is_constant_evaluated()) { | 3416 | | // Use Dragonbox for the shortest format. | 3417 | 16.1k | using floaty = conditional_t<sizeof(T) >= sizeof(double), double, float>; | 3418 | 16.1k | auto dec = dragonbox::to_decimal(static_cast<floaty>(value)); | 3419 | 16.1k | return write_float<Char>(out, dec, specs, s, loc); | 3420 | 16.1k | } | 3421 | 42.2k | } | 3422 | | | 3423 | 89.6k | memory_buffer buffer; | 3424 | 89.6k | if (specs.type() == presentation_type::hexfloat) { | 3425 | 4.12k | if (s != sign::none) buffer.push_back(detail::getsign<char>(s)); | 3426 | 4.12k | format_hexfloat(convert_float(value), specs, buffer); | 3427 | 4.12k | return write_bytes<Char, align::right>(out, {buffer.data(), buffer.size()}, | 3428 | 4.12k | specs); | 3429 | 4.12k | } | 3430 | | | 3431 | 85.4k | if (specs.type() == presentation_type::exp) { | 3432 | 2.04k | if (precision == max_value<int>()) | 3433 | 3 | report_error("number is too big"); | 3434 | 2.03k | else | 3435 | 2.03k | ++precision; | 3436 | 2.04k | if (specs.precision != 0) specs.set_alt(); | 3437 | 83.4k | } else if (specs.type() == presentation_type::fixed) { | 3438 | 64.3k | if (specs.precision != 0) specs.set_alt(); | 3439 | 64.3k | } else if (precision == 0) { | 3440 | 847 | precision = 1; | 3441 | 847 | } | 3442 | 85.4k | int exp = format_float(convert_float(value), precision, specs, | 3443 | 85.4k | std::is_same<T, float>(), buffer); | 3444 | | | 3445 | 85.4k | specs.precision = precision; | 3446 | 85.4k | auto f = big_decimal_fp{buffer.data(), static_cast<int>(buffer.size()), exp}; | 3447 | 85.4k | return write_float<Char>(out, f, specs, s, loc); | 3448 | 89.6k | } |
|
3449 | | |
3450 | | template <typename Char, typename OutputIt, typename T, |
3451 | | FMT_ENABLE_IF(is_floating_point<T>::value)> |
3452 | | FMT_CONSTEXPR20 auto write(OutputIt out, T value, format_specs specs, |
3453 | 353k | locale_ref loc = {}) -> OutputIt { |
3454 | 353k | return specs.localized() && write_loc(out, value, specs, loc) |
3455 | 353k | ? out |
3456 | 353k | : write_float<Char>(out, value, specs, loc); |
3457 | 353k | } _ZN3fmt3v116detail5writeIcNS0_14basic_appenderIcEEeTnNSt3__19enable_ifIXsr17is_floating_pointIT1_EE5valueEiE4typeELi0EEET0_SA_S7_NS0_12format_specsENS1_10locale_refE Line | Count | Source | 3453 | 128k | locale_ref loc = {}) -> OutputIt { | 3454 | 128k | return specs.localized() && write_loc(out, value, specs, loc) | 3455 | 128k | ? out | 3456 | 128k | : write_float<Char>(out, value, specs, loc); | 3457 | 128k | } |
_ZN3fmt3v116detail5writeIcNS0_14basic_appenderIcEEfTnNSt3__19enable_ifIXsr17is_floating_pointIT1_EE5valueEiE4typeELi0EEET0_SA_S7_NS0_12format_specsENS1_10locale_refE Line | Count | Source | 3453 | 110k | locale_ref loc = {}) -> OutputIt { | 3454 | 110k | return specs.localized() && write_loc(out, value, specs, loc) | 3455 | 110k | ? out | 3456 | 110k | : write_float<Char>(out, value, specs, loc); | 3457 | 110k | } |
_ZN3fmt3v116detail5writeIcNS0_14basic_appenderIcEEdTnNSt3__19enable_ifIXsr17is_floating_pointIT1_EE5valueEiE4typeELi0EEET0_SA_S7_NS0_12format_specsENS1_10locale_refE Line | Count | Source | 3453 | 114k | locale_ref loc = {}) -> OutputIt { | 3454 | 114k | return specs.localized() && write_loc(out, value, specs, loc) | 3455 | 114k | ? out | 3456 | 114k | : write_float<Char>(out, value, specs, loc); | 3457 | 114k | } |
|
3458 | | |
3459 | | template <typename Char, typename OutputIt, typename T, |
3460 | | FMT_ENABLE_IF(is_fast_float<T>::value)> |
3461 | 39.0k | FMT_CONSTEXPR20 auto write(OutputIt out, T value) -> OutputIt { |
3462 | 39.0k | if (is_constant_evaluated()) return write<Char>(out, value, format_specs()); |
3463 | | |
3464 | 39.0k | auto s = detail::signbit(value) ? sign::minus : sign::none; |
3465 | | |
3466 | 39.0k | constexpr auto specs = format_specs(); |
3467 | 39.0k | using floaty = conditional_t<sizeof(T) >= sizeof(double), double, float>; |
3468 | 39.0k | using floaty_uint = typename dragonbox::float_info<floaty>::carrier_uint; |
3469 | 39.0k | floaty_uint mask = exponent_mask<floaty>(); |
3470 | 39.0k | if ((bit_cast<floaty_uint>(value) & mask) == mask) |
3471 | 3.65k | return write_nonfinite<Char>(out, std::isnan(value), specs, s); |
3472 | | |
3473 | 35.4k | auto dec = dragonbox::to_decimal(static_cast<floaty>(value)); |
3474 | 35.4k | return write_float<Char>(out, dec, specs, s, {}); |
3475 | 39.0k | } _ZN3fmt3v116detail5writeIcNS0_14basic_appenderIcEEfTnNSt3__19enable_ifIXsr13is_fast_floatIT1_EE5valueEiE4typeELi0EEET0_SA_S7_ Line | Count | Source | 3461 | 17.6k | FMT_CONSTEXPR20 auto write(OutputIt out, T value) -> OutputIt { | 3462 | 17.6k | if (is_constant_evaluated()) return write<Char>(out, value, format_specs()); | 3463 | | | 3464 | 17.6k | auto s = detail::signbit(value) ? sign::minus : sign::none; | 3465 | | | 3466 | 17.6k | constexpr auto specs = format_specs(); | 3467 | 17.6k | using floaty = conditional_t<sizeof(T) >= sizeof(double), double, float>; | 3468 | 17.6k | using floaty_uint = typename dragonbox::float_info<floaty>::carrier_uint; | 3469 | 17.6k | floaty_uint mask = exponent_mask<floaty>(); | 3470 | 17.6k | if ((bit_cast<floaty_uint>(value) & mask) == mask) | 3471 | 1.82k | return write_nonfinite<Char>(out, std::isnan(value), specs, s); | 3472 | | | 3473 | 15.8k | auto dec = dragonbox::to_decimal(static_cast<floaty>(value)); | 3474 | 15.8k | return write_float<Char>(out, dec, specs, s, {}); | 3475 | 17.6k | } |
_ZN3fmt3v116detail5writeIcNS0_14basic_appenderIcEEdTnNSt3__19enable_ifIXsr13is_fast_floatIT1_EE5valueEiE4typeELi0EEET0_SA_S7_ Line | Count | Source | 3461 | 21.4k | FMT_CONSTEXPR20 auto write(OutputIt out, T value) -> OutputIt { | 3462 | 21.4k | if (is_constant_evaluated()) return write<Char>(out, value, format_specs()); | 3463 | | | 3464 | 21.4k | auto s = detail::signbit(value) ? sign::minus : sign::none; | 3465 | | | 3466 | 21.4k | constexpr auto specs = format_specs(); | 3467 | 21.4k | using floaty = conditional_t<sizeof(T) >= sizeof(double), double, float>; | 3468 | 21.4k | using floaty_uint = typename dragonbox::float_info<floaty>::carrier_uint; | 3469 | 21.4k | floaty_uint mask = exponent_mask<floaty>(); | 3470 | 21.4k | if ((bit_cast<floaty_uint>(value) & mask) == mask) | 3471 | 1.82k | return write_nonfinite<Char>(out, std::isnan(value), specs, s); | 3472 | | | 3473 | 19.6k | auto dec = dragonbox::to_decimal(static_cast<floaty>(value)); | 3474 | 19.6k | return write_float<Char>(out, dec, specs, s, {}); | 3475 | 21.4k | } |
|
3476 | | |
3477 | | template <typename Char, typename OutputIt, typename T, |
3478 | | FMT_ENABLE_IF(is_floating_point<T>::value && |
3479 | | !is_fast_float<T>::value)> |
3480 | 21.7k | inline auto write(OutputIt out, T value) -> OutputIt { |
3481 | 21.7k | return write<Char>(out, value, format_specs()); |
3482 | 21.7k | } |
3483 | | |
3484 | | template <typename Char, typename OutputIt> |
3485 | | auto write(OutputIt out, monostate, format_specs = {}, locale_ref = {}) |
3486 | 0 | -> OutputIt { |
3487 | 0 | FMT_ASSERT(false, ""); |
3488 | 0 | return out; |
3489 | 0 | } |
3490 | | |
3491 | | template <typename Char, typename OutputIt> |
3492 | | FMT_CONSTEXPR auto write(OutputIt out, basic_string_view<Char> value) |
3493 | 168k | -> OutputIt { |
3494 | 168k | return copy_noinline<Char>(value.begin(), value.end(), out); |
3495 | 168k | } |
3496 | | |
3497 | | template <typename Char, typename OutputIt, typename T, |
3498 | | FMT_ENABLE_IF(has_to_string_view<T>::value)> |
3499 | | constexpr auto write(OutputIt out, const T& value) -> OutputIt { |
3500 | | return write<Char>(out, to_string_view(value)); |
3501 | | } |
3502 | | |
3503 | | // FMT_ENABLE_IF() condition separated to workaround an MSVC bug. |
3504 | | template < |
3505 | | typename Char, typename OutputIt, typename T, |
3506 | | bool check = std::is_enum<T>::value && !std::is_same<T, Char>::value && |
3507 | | mapped_type_constant<T, Char>::value != type::custom_type, |
3508 | | FMT_ENABLE_IF(check)> |
3509 | | FMT_CONSTEXPR auto write(OutputIt out, T value) -> OutputIt { |
3510 | | return write<Char>(out, static_cast<underlying_t<T>>(value)); |
3511 | | } |
3512 | | |
3513 | | template <typename Char, typename OutputIt, typename T, |
3514 | | FMT_ENABLE_IF(std::is_same<T, bool>::value)> |
3515 | | FMT_CONSTEXPR auto write(OutputIt out, T value, const format_specs& specs = {}, |
3516 | 8.85k | locale_ref = {}) -> OutputIt { |
3517 | 8.85k | return specs.type() != presentation_type::none && |
3518 | 8.85k | specs.type() != presentation_type::string |
3519 | 8.85k | ? write<Char>(out, value ? 1 : 0, specs, {}) |
3520 | 8.85k | : write_bytes<Char>(out, value ? "true" : "false", specs); |
3521 | 8.85k | } |
3522 | | |
3523 | | template <typename Char, typename OutputIt> |
3524 | 16.0k | FMT_CONSTEXPR auto write(OutputIt out, Char value) -> OutputIt { |
3525 | 16.0k | auto it = reserve(out, 1); |
3526 | 16.0k | *it++ = value; |
3527 | 16.0k | return base_iterator(out, it); |
3528 | 16.0k | } |
3529 | | |
3530 | | template <typename Char, typename OutputIt> |
3531 | 168k | FMT_CONSTEXPR20 auto write(OutputIt out, const Char* value) -> OutputIt { |
3532 | 168k | if (value) return write(out, basic_string_view<Char>(value)); |
3533 | 0 | report_error("string pointer is null"); |
3534 | 0 | return out; |
3535 | 168k | } |
3536 | | |
3537 | | template <typename Char, typename OutputIt, typename T, |
3538 | | FMT_ENABLE_IF(std::is_same<T, void>::value)> |
3539 | | auto write(OutputIt out, const T* value, const format_specs& specs = {}, |
3540 | 2.17k | locale_ref = {}) -> OutputIt { |
3541 | 2.17k | return write_ptr<Char>(out, bit_cast<uintptr_t>(value), &specs); |
3542 | 2.17k | } |
3543 | | |
3544 | | template <typename Char, typename OutputIt, typename T, |
3545 | | FMT_ENABLE_IF(mapped_type_constant<T, Char>::value == |
3546 | | type::custom_type && |
3547 | | !std::is_fundamental<T>::value)> |
3548 | | FMT_CONSTEXPR auto write(OutputIt out, const T& value) -> OutputIt { |
3549 | | auto f = formatter<T, Char>(); |
3550 | | auto parse_ctx = parse_context<Char>({}); |
3551 | | f.parse(parse_ctx); |
3552 | | auto ctx = basic_format_context<OutputIt, Char>(out, {}, {}); |
3553 | | return f.format(value, ctx); |
3554 | | } |
3555 | | |
3556 | | template <typename T> |
3557 | | using is_builtin = |
3558 | | bool_constant<std::is_same<T, int>::value || FMT_BUILTIN_TYPES>; |
3559 | | |
3560 | | // An argument visitor that formats the argument and writes it via the output |
3561 | | // iterator. It's a class and not a generic lambda for compatibility with C++11. |
3562 | | template <typename Char> struct default_arg_formatter { |
3563 | | using context = buffered_context<Char>; |
3564 | | |
3565 | | basic_appender<Char> out; |
3566 | | |
3567 | 183 | void operator()(monostate) { report_error("argument not found"); } |
3568 | | |
3569 | | template <typename T, FMT_ENABLE_IF(is_builtin<T>::value)> |
3570 | 94.6k | void operator()(T value) { |
3571 | 94.6k | write<Char>(out, value); |
3572 | 94.6k | } _ZN3fmt3v116detail21default_arg_formatterIcEclIiTnNSt3__19enable_ifIXsr10is_builtinIT_EE5valueEiE4typeELi0EEEvS7_ Line | Count | Source | 3570 | 6.62k | void operator()(T value) { | 3571 | 6.62k | write<Char>(out, value); | 3572 | 6.62k | } |
_ZN3fmt3v116detail21default_arg_formatterIcEclIjTnNSt3__19enable_ifIXsr10is_builtinIT_EE5valueEiE4typeELi0EEEvS7_ Line | Count | Source | 3570 | 6.63k | void operator()(T value) { | 3571 | 6.63k | write<Char>(out, value); | 3572 | 6.63k | } |
_ZN3fmt3v116detail21default_arg_formatterIcEclIxTnNSt3__19enable_ifIXsr10is_builtinIT_EE5valueEiE4typeELi0EEEvS7_ Line | Count | Source | 3570 | 4.08k | void operator()(T value) { | 3571 | 4.08k | write<Char>(out, value); | 3572 | 4.08k | } |
_ZN3fmt3v116detail21default_arg_formatterIcEclIyTnNSt3__19enable_ifIXsr10is_builtinIT_EE5valueEiE4typeELi0EEEvS7_ Line | Count | Source | 3570 | 4.70k | void operator()(T value) { | 3571 | 4.70k | write<Char>(out, value); | 3572 | 4.70k | } |
Unexecuted instantiation: _ZN3fmt3v116detail21default_arg_formatterIcEclInTnNSt3__19enable_ifIXsr10is_builtinIT_EE5valueEiE4typeELi0EEEvS7_ Unexecuted instantiation: _ZN3fmt3v116detail21default_arg_formatterIcEclIoTnNSt3__19enable_ifIXsr10is_builtinIT_EE5valueEiE4typeELi0EEEvS7_ _ZN3fmt3v116detail21default_arg_formatterIcEclIbTnNSt3__19enable_ifIXsr10is_builtinIT_EE5valueEiE4typeELi0EEEvS7_ Line | Count | Source | 3570 | 2.94k | void operator()(T value) { | 3571 | 2.94k | write<Char>(out, value); | 3572 | 2.94k | } |
_ZN3fmt3v116detail21default_arg_formatterIcEclIcTnNSt3__19enable_ifIXsr10is_builtinIT_EE5valueEiE4typeELi0EEEvS7_ Line | Count | Source | 3570 | 7.42k | void operator()(T value) { | 3571 | 7.42k | write<Char>(out, value); | 3572 | 7.42k | } |
_ZN3fmt3v116detail21default_arg_formatterIcEclIfTnNSt3__19enable_ifIXsr10is_builtinIT_EE5valueEiE4typeELi0EEEvS7_ Line | Count | Source | 3570 | 17.6k | void operator()(T value) { | 3571 | 17.6k | write<Char>(out, value); | 3572 | 17.6k | } |
_ZN3fmt3v116detail21default_arg_formatterIcEclIdTnNSt3__19enable_ifIXsr10is_builtinIT_EE5valueEiE4typeELi0EEEvS7_ Line | Count | Source | 3570 | 21.4k | void operator()(T value) { | 3571 | 21.4k | write<Char>(out, value); | 3572 | 21.4k | } |
_ZN3fmt3v116detail21default_arg_formatterIcEclIeTnNSt3__19enable_ifIXsr10is_builtinIT_EE5valueEiE4typeELi0EEEvS7_ Line | Count | Source | 3570 | 21.7k | void operator()(T value) { | 3571 | 21.7k | write<Char>(out, value); | 3572 | 21.7k | } |
Unexecuted instantiation: _ZN3fmt3v116detail21default_arg_formatterIcEclIPKcTnNSt3__19enable_ifIXsr10is_builtinIT_EE5valueEiE4typeELi0EEEvS9_ Unexecuted instantiation: _ZN3fmt3v116detail21default_arg_formatterIcEclINS0_17basic_string_viewIcEETnNSt3__19enable_ifIXsr10is_builtinIT_EE5valueEiE4typeELi0EEEvS9_ _ZN3fmt3v116detail21default_arg_formatterIcEclIPKvTnNSt3__19enable_ifIXsr10is_builtinIT_EE5valueEiE4typeELi0EEEvS9_ Line | Count | Source | 3570 | 1.39k | void operator()(T value) { | 3571 | 1.39k | write<Char>(out, value); | 3572 | 1.39k | } |
|
3573 | | |
3574 | | template <typename T, FMT_ENABLE_IF(!is_builtin<T>::value)> |
3575 | | void operator()(T) { |
3576 | | FMT_ASSERT(false, ""); |
3577 | | } |
3578 | | |
3579 | 45.2k | void operator()(typename basic_format_arg<context>::handle h) { |
3580 | | // Use a null locale since the default format must be unlocalized. |
3581 | 45.2k | auto parse_ctx = parse_context<Char>({}); |
3582 | 45.2k | auto format_ctx = context(out, {}, {}); |
3583 | 45.2k | h.format(parse_ctx, format_ctx); |
3584 | 45.2k | } |
3585 | | }; |
3586 | | |
3587 | | template <typename Char> struct arg_formatter { |
3588 | | basic_appender<Char> out; |
3589 | | const format_specs& specs; |
3590 | | FMT_NO_UNIQUE_ADDRESS locale_ref locale; |
3591 | | |
3592 | | template <typename T, FMT_ENABLE_IF(is_builtin<T>::value)> |
3593 | 346k | FMT_CONSTEXPR FMT_INLINE void operator()(T value) { |
3594 | 346k | detail::write<Char>(out, value, specs, locale); |
3595 | 346k | } _ZN3fmt3v116detail13arg_formatterIcEclIiTnNSt3__19enable_ifIXsr10is_builtinIT_EE5valueEiE4typeELi0EEEvS7_ Line | Count | Source | 3593 | 17.8k | FMT_CONSTEXPR FMT_INLINE void operator()(T value) { | 3594 | 17.8k | detail::write<Char>(out, value, specs, locale); | 3595 | 17.8k | } |
_ZN3fmt3v116detail13arg_formatterIcEclIjTnNSt3__19enable_ifIXsr10is_builtinIT_EE5valueEiE4typeELi0EEEvS7_ Line | Count | Source | 3593 | 8.62k | FMT_CONSTEXPR FMT_INLINE void operator()(T value) { | 3594 | 8.62k | detail::write<Char>(out, value, specs, locale); | 3595 | 8.62k | } |
_ZN3fmt3v116detail13arg_formatterIcEclIxTnNSt3__19enable_ifIXsr10is_builtinIT_EE5valueEiE4typeELi0EEEvS7_ Line | Count | Source | 3593 | 19.6k | FMT_CONSTEXPR FMT_INLINE void operator()(T value) { | 3594 | 19.6k | detail::write<Char>(out, value, specs, locale); | 3595 | 19.6k | } |
_ZN3fmt3v116detail13arg_formatterIcEclIyTnNSt3__19enable_ifIXsr10is_builtinIT_EE5valueEiE4typeELi0EEEvS7_ Line | Count | Source | 3593 | 6.90k | FMT_CONSTEXPR FMT_INLINE void operator()(T value) { | 3594 | 6.90k | detail::write<Char>(out, value, specs, locale); | 3595 | 6.90k | } |
Unexecuted instantiation: _ZN3fmt3v116detail13arg_formatterIcEclInTnNSt3__19enable_ifIXsr10is_builtinIT_EE5valueEiE4typeELi0EEEvS7_ Unexecuted instantiation: _ZN3fmt3v116detail13arg_formatterIcEclIoTnNSt3__19enable_ifIXsr10is_builtinIT_EE5valueEiE4typeELi0EEEvS7_ _ZN3fmt3v116detail13arg_formatterIcEclIbTnNSt3__19enable_ifIXsr10is_builtinIT_EE5valueEiE4typeELi0EEEvS7_ Line | Count | Source | 3593 | 5.91k | FMT_CONSTEXPR FMT_INLINE void operator()(T value) { | 3594 | 5.91k | detail::write<Char>(out, value, specs, locale); | 3595 | 5.91k | } |
_ZN3fmt3v116detail13arg_formatterIcEclIcTnNSt3__19enable_ifIXsr10is_builtinIT_EE5valueEiE4typeELi0EEEvS7_ Line | Count | Source | 3593 | 19.5k | FMT_CONSTEXPR FMT_INLINE void operator()(T value) { | 3594 | 19.5k | detail::write<Char>(out, value, specs, locale); | 3595 | 19.5k | } |
_ZN3fmt3v116detail13arg_formatterIcEclIfTnNSt3__19enable_ifIXsr10is_builtinIT_EE5valueEiE4typeELi0EEEvS7_ Line | Count | Source | 3593 | 89.9k | FMT_CONSTEXPR FMT_INLINE void operator()(T value) { | 3594 | 89.9k | detail::write<Char>(out, value, specs, locale); | 3595 | 89.9k | } |
_ZN3fmt3v116detail13arg_formatterIcEclIdTnNSt3__19enable_ifIXsr10is_builtinIT_EE5valueEiE4typeELi0EEEvS7_ Line | Count | Source | 3593 | 93.3k | FMT_CONSTEXPR FMT_INLINE void operator()(T value) { | 3594 | 93.3k | detail::write<Char>(out, value, specs, locale); | 3595 | 93.3k | } |
_ZN3fmt3v116detail13arg_formatterIcEclIeTnNSt3__19enable_ifIXsr10is_builtinIT_EE5valueEiE4typeELi0EEEvS7_ Line | Count | Source | 3593 | 83.4k | FMT_CONSTEXPR FMT_INLINE void operator()(T value) { | 3594 | 83.4k | detail::write<Char>(out, value, specs, locale); | 3595 | 83.4k | } |
Unexecuted instantiation: _ZN3fmt3v116detail13arg_formatterIcEclIPKcTnNSt3__19enable_ifIXsr10is_builtinIT_EE5valueEiE4typeELi0EEEvS9_ Unexecuted instantiation: _ZN3fmt3v116detail13arg_formatterIcEclINS0_17basic_string_viewIcEETnNSt3__19enable_ifIXsr10is_builtinIT_EE5valueEiE4typeELi0EEEvS9_ _ZN3fmt3v116detail13arg_formatterIcEclIPKvTnNSt3__19enable_ifIXsr10is_builtinIT_EE5valueEiE4typeELi0EEEvS9_ Line | Count | Source | 3593 | 782 | FMT_CONSTEXPR FMT_INLINE void operator()(T value) { | 3594 | 782 | detail::write<Char>(out, value, specs, locale); | 3595 | 782 | } |
Unexecuted instantiation: _ZN3fmt3v116detail13arg_formatterIcEclINS0_9monostateETnNSt3__19enable_ifIXsr10is_builtinIT_EE5valueEiE4typeELi0EEEvS8_ |
3596 | | |
3597 | | template <typename T, FMT_ENABLE_IF(!is_builtin<T>::value)> |
3598 | | void operator()(T) { |
3599 | | FMT_ASSERT(false, ""); |
3600 | | } |
3601 | | |
3602 | 0 | void operator()(typename basic_format_arg<buffered_context<Char>>::handle) { |
3603 | | // User-defined types are handled separately because they require access |
3604 | | // to the parse context. |
3605 | 0 | } |
3606 | | }; |
3607 | | |
3608 | | struct dynamic_spec_getter { |
3609 | | template <typename T, FMT_ENABLE_IF(is_integer<T>::value)> |
3610 | 159k | FMT_CONSTEXPR auto operator()(T value) -> unsigned long long { |
3611 | 159k | return is_negative(value) ? ~0ull : static_cast<unsigned long long>(value); |
3612 | 159k | } _ZN3fmt3v116detail19dynamic_spec_getterclIiTnNSt3__19enable_ifIXsr10is_integerIT_EE5valueEiE4typeELi0EEEyS6_ Line | Count | Source | 3610 | 153k | FMT_CONSTEXPR auto operator()(T value) -> unsigned long long { | 3611 | 153k | return is_negative(value) ? ~0ull : static_cast<unsigned long long>(value); | 3612 | 153k | } |
_ZN3fmt3v116detail19dynamic_spec_getterclIjTnNSt3__19enable_ifIXsr10is_integerIT_EE5valueEiE4typeELi0EEEyS6_ Line | Count | Source | 3610 | 4.20k | FMT_CONSTEXPR auto operator()(T value) -> unsigned long long { | 3611 | 4.20k | return is_negative(value) ? ~0ull : static_cast<unsigned long long>(value); | 3612 | 4.20k | } |
_ZN3fmt3v116detail19dynamic_spec_getterclIxTnNSt3__19enable_ifIXsr10is_integerIT_EE5valueEiE4typeELi0EEEyS6_ Line | Count | Source | 3610 | 1.12k | FMT_CONSTEXPR auto operator()(T value) -> unsigned long long { | 3611 | 1.12k | return is_negative(value) ? ~0ull : static_cast<unsigned long long>(value); | 3612 | 1.12k | } |
_ZN3fmt3v116detail19dynamic_spec_getterclIyTnNSt3__19enable_ifIXsr10is_integerIT_EE5valueEiE4typeELi0EEEyS6_ Line | Count | Source | 3610 | 828 | FMT_CONSTEXPR auto operator()(T value) -> unsigned long long { | 3611 | 828 | return is_negative(value) ? ~0ull : static_cast<unsigned long long>(value); | 3612 | 828 | } |
Unexecuted instantiation: _ZN3fmt3v116detail19dynamic_spec_getterclInTnNSt3__19enable_ifIXsr10is_integerIT_EE5valueEiE4typeELi0EEEyS6_ Unexecuted instantiation: _ZN3fmt3v116detail19dynamic_spec_getterclIoTnNSt3__19enable_ifIXsr10is_integerIT_EE5valueEiE4typeELi0EEEyS6_ |
3613 | | |
3614 | | template <typename T, FMT_ENABLE_IF(!is_integer<T>::value)> |
3615 | 123 | FMT_CONSTEXPR auto operator()(T) -> unsigned long long { |
3616 | 123 | report_error("width/precision is not integer"); |
3617 | 123 | return 0; |
3618 | 123 | } _ZN3fmt3v116detail19dynamic_spec_getterclIbTnNSt3__19enable_ifIXntsr10is_integerIT_EE5valueEiE4typeELi0EEEyS6_ Line | Count | Source | 3615 | 5 | FMT_CONSTEXPR auto operator()(T) -> unsigned long long { | 3616 | 5 | report_error("width/precision is not integer"); | 3617 | 5 | return 0; | 3618 | 5 | } |
_ZN3fmt3v116detail19dynamic_spec_getterclIcTnNSt3__19enable_ifIXntsr10is_integerIT_EE5valueEiE4typeELi0EEEyS6_ Line | Count | Source | 3615 | 6 | FMT_CONSTEXPR auto operator()(T) -> unsigned long long { | 3616 | 6 | report_error("width/precision is not integer"); | 3617 | 6 | return 0; | 3618 | 6 | } |
_ZN3fmt3v116detail19dynamic_spec_getterclIfTnNSt3__19enable_ifIXntsr10is_integerIT_EE5valueEiE4typeELi0EEEyS6_ Line | Count | Source | 3615 | 4 | FMT_CONSTEXPR auto operator()(T) -> unsigned long long { | 3616 | 4 | report_error("width/precision is not integer"); | 3617 | 4 | return 0; | 3618 | 4 | } |
_ZN3fmt3v116detail19dynamic_spec_getterclIdTnNSt3__19enable_ifIXntsr10is_integerIT_EE5valueEiE4typeELi0EEEyS6_ Line | Count | Source | 3615 | 3 | FMT_CONSTEXPR auto operator()(T) -> unsigned long long { | 3616 | 3 | report_error("width/precision is not integer"); | 3617 | 3 | return 0; | 3618 | 3 | } |
_ZN3fmt3v116detail19dynamic_spec_getterclIeTnNSt3__19enable_ifIXntsr10is_integerIT_EE5valueEiE4typeELi0EEEyS6_ Line | Count | Source | 3615 | 3 | FMT_CONSTEXPR auto operator()(T) -> unsigned long long { | 3616 | 3 | report_error("width/precision is not integer"); | 3617 | 3 | return 0; | 3618 | 3 | } |
Unexecuted instantiation: _ZN3fmt3v116detail19dynamic_spec_getterclIPKcTnNSt3__19enable_ifIXntsr10is_integerIT_EE5valueEiE4typeELi0EEEyS8_ Unexecuted instantiation: _ZN3fmt3v116detail19dynamic_spec_getterclINS0_17basic_string_viewIcEETnNSt3__19enable_ifIXntsr10is_integerIT_EE5valueEiE4typeELi0EEEyS8_ _ZN3fmt3v116detail19dynamic_spec_getterclIPKvTnNSt3__19enable_ifIXntsr10is_integerIT_EE5valueEiE4typeELi0EEEyS8_ Line | Count | Source | 3615 | 1 | FMT_CONSTEXPR auto operator()(T) -> unsigned long long { | 3616 | 1 | report_error("width/precision is not integer"); | 3617 | 1 | return 0; | 3618 | 1 | } |
_ZN3fmt3v116detail19dynamic_spec_getterclINS0_16basic_format_argINS0_7contextEE6handleETnNSt3__19enable_ifIXntsr10is_integerIT_EE5valueEiE4typeELi0EEEySA_ Line | Count | Source | 3615 | 101 | FMT_CONSTEXPR auto operator()(T) -> unsigned long long { | 3616 | 101 | report_error("width/precision is not integer"); | 3617 | 101 | return 0; | 3618 | 101 | } |
Unexecuted instantiation: _ZN3fmt3v116detail19dynamic_spec_getterclINS0_9monostateETnNSt3__19enable_ifIXntsr10is_integerIT_EE5valueEiE4typeELi0EEEyS7_ |
3619 | | }; |
3620 | | |
3621 | | template <typename Context, typename ID> |
3622 | 629k | FMT_CONSTEXPR auto get_arg(Context& ctx, ID id) -> basic_format_arg<Context> { |
3623 | 629k | auto arg = ctx.arg(id); |
3624 | 629k | if (!arg) report_error("argument not found"); |
3625 | 629k | return arg; |
3626 | 629k | } |
3627 | | |
3628 | | template <typename Context> |
3629 | | FMT_CONSTEXPR int get_dynamic_spec( |
3630 | | arg_id_kind kind, const arg_ref<typename Context::char_type>& ref, |
3631 | 160k | Context& ctx) { |
3632 | 160k | FMT_ASSERT(kind != arg_id_kind::none, ""); |
3633 | 160k | auto arg = |
3634 | 160k | kind == arg_id_kind::index ? ctx.arg(ref.index) : ctx.arg(ref.name); |
3635 | 160k | if (!arg) report_error("argument not found"); |
3636 | 160k | unsigned long long value = arg.visit(dynamic_spec_getter()); |
3637 | 160k | if (value > to_unsigned(max_value<int>())) |
3638 | 351 | report_error("width/precision is out of range"); |
3639 | 160k | return static_cast<int>(value); |
3640 | 160k | } |
3641 | | |
3642 | | template <typename Context> |
3643 | | FMT_CONSTEXPR void handle_dynamic_spec( |
3644 | | arg_id_kind kind, int& value, |
3645 | 949k | const arg_ref<typename Context::char_type>& ref, Context& ctx) { |
3646 | 949k | if (kind != arg_id_kind::none) value = get_dynamic_spec(kind, ref, ctx); |
3647 | 949k | } |
3648 | | |
3649 | | #if FMT_USE_NONTYPE_TEMPLATE_ARGS |
3650 | | template <typename T, typename Char, size_t N, |
3651 | | fmt::detail::fixed_string<Char, N> Str> |
3652 | | struct static_named_arg : view { |
3653 | | static constexpr auto name = Str.data; |
3654 | | |
3655 | | const T& value; |
3656 | | static_named_arg(const T& v) : value(v) {} |
3657 | | }; |
3658 | | |
3659 | | template <typename T, typename Char, size_t N, |
3660 | | fmt::detail::fixed_string<Char, N> Str> |
3661 | | struct is_named_arg<static_named_arg<T, Char, N, Str>> : std::true_type {}; |
3662 | | |
3663 | | template <typename T, typename Char, size_t N, |
3664 | | fmt::detail::fixed_string<Char, N> Str> |
3665 | | struct is_static_named_arg<static_named_arg<T, Char, N, Str>> : std::true_type { |
3666 | | }; |
3667 | | |
3668 | | template <typename Char, size_t N, fmt::detail::fixed_string<Char, N> Str> |
3669 | | struct udl_arg { |
3670 | | template <typename T> auto operator=(T&& value) const { |
3671 | | return static_named_arg<T, Char, N, Str>(std::forward<T>(value)); |
3672 | | } |
3673 | | }; |
3674 | | #else |
3675 | | template <typename Char> struct udl_arg { |
3676 | | const Char* str; |
3677 | | |
3678 | | template <typename T> auto operator=(T&& value) const -> named_arg<Char, T> { |
3679 | | return {str, std::forward<T>(value)}; |
3680 | | } |
3681 | | }; |
3682 | | #endif // FMT_USE_NONTYPE_TEMPLATE_ARGS |
3683 | | |
3684 | | template <typename Char> struct format_handler { |
3685 | | parse_context<Char> parse_ctx; |
3686 | | buffered_context<Char> ctx; |
3687 | | |
3688 | 956k | void on_text(const Char* begin, const Char* end) { |
3689 | 956k | copy_noinline<Char>(begin, end, ctx.out()); |
3690 | 956k | } |
3691 | | |
3692 | 170k | FMT_CONSTEXPR auto on_arg_id() -> int { return parse_ctx.next_arg_id(); } |
3693 | 568k | FMT_CONSTEXPR auto on_arg_id(int id) -> int { |
3694 | 568k | parse_ctx.check_arg_id(id); |
3695 | 568k | return id; |
3696 | 568k | } |
3697 | 27.8k | FMT_CONSTEXPR auto on_arg_id(basic_string_view<Char> id) -> int { |
3698 | 27.8k | parse_ctx.check_arg_id(id); |
3699 | 27.8k | int arg_id = ctx.arg_id(id); |
3700 | 27.8k | if (arg_id < 0) report_error("argument not found"); |
3701 | 27.8k | return arg_id; |
3702 | 27.8k | } |
3703 | | |
3704 | 136k | FMT_INLINE void on_replacement_field(int id, const Char*) { |
3705 | 136k | ctx.arg(id).visit(default_arg_formatter<Char>{ctx.out()}); |
3706 | 136k | } |
3707 | | |
3708 | | auto on_format_specs(int id, const Char* begin, const Char* end) |
3709 | 629k | -> const Char* { |
3710 | 629k | auto arg = get_arg(ctx, id); |
3711 | | // Not using a visitor for custom types gives better codegen. |
3712 | 629k | if (arg.format_custom(begin, parse_ctx, ctx)) return parse_ctx.begin(); |
3713 | | |
3714 | 357k | auto specs = dynamic_format_specs<Char>(); |
3715 | 357k | begin = parse_format_specs(begin, end, specs, parse_ctx, arg.type()); |
3716 | 357k | if (specs.dynamic()) { |
3717 | 159k | handle_dynamic_spec(specs.dynamic_width(), specs.width, specs.width_ref, |
3718 | 159k | ctx); |
3719 | 159k | handle_dynamic_spec(specs.dynamic_precision(), specs.precision, |
3720 | 159k | specs.precision_ref, ctx); |
3721 | 159k | } |
3722 | | |
3723 | 357k | arg.visit(arg_formatter<Char>{ctx.out(), specs, ctx.locale()}); |
3724 | 357k | return begin; |
3725 | 629k | } |
3726 | | |
3727 | 22.1k | FMT_NORETURN void on_error(const char* message) { report_error(message); } |
3728 | | }; |
3729 | | |
3730 | | using format_func = void (*)(detail::buffer<char>&, int, const char*); |
3731 | | FMT_API void do_report_error(format_func func, int error_code, |
3732 | | const char* message) noexcept; |
3733 | | |
3734 | | FMT_API void format_error_code(buffer<char>& out, int error_code, |
3735 | | string_view message) noexcept; |
3736 | | |
3737 | | template <typename T, typename Char, type TYPE> |
3738 | | template <typename FormatContext> |
3739 | | FMT_CONSTEXPR auto native_formatter<T, Char, TYPE>::format( |
3740 | | const T& val, FormatContext& ctx) const -> decltype(ctx.out()) { |
3741 | | if (!specs_.dynamic()) |
3742 | | return write<Char>(ctx.out(), val, specs_, ctx.locale()); |
3743 | | auto specs = format_specs(specs_); |
3744 | | handle_dynamic_spec(specs.dynamic_width(), specs.width, specs_.width_ref, |
3745 | | ctx); |
3746 | | handle_dynamic_spec(specs.dynamic_precision(), specs.precision, |
3747 | | specs_.precision_ref, ctx); |
3748 | | return write<Char>(ctx.out(), val, specs, ctx.locale()); |
3749 | | } |
3750 | | |
3751 | | // DEPRECATED! |
3752 | | template <typename Char = char> struct vformat_args { |
3753 | | using type = basic_format_args<buffered_context<Char>>; |
3754 | | }; |
3755 | | template <> struct vformat_args<char> { |
3756 | | using type = format_args; |
3757 | | }; |
3758 | | |
3759 | | template <typename Char> |
3760 | | void vformat_to(buffer<Char>& buf, basic_string_view<Char> fmt, |
3761 | 0 | typename vformat_args<Char>::type args, locale_ref loc = {}) { |
3762 | 0 | auto out = basic_appender<Char>(buf); |
3763 | 0 | parse_format_string( |
3764 | 0 | fmt, format_handler<Char>{parse_context<Char>(fmt), {out, args, loc}}); |
3765 | 0 | } |
3766 | | } // namespace detail |
3767 | | |
3768 | | FMT_BEGIN_EXPORT |
3769 | | |
3770 | | #define FMT_FORMAT_AS(Type, Base) \ |
3771 | | template <typename Char> \ |
3772 | | struct formatter<Type, Char> : formatter<Base, Char> { \ |
3773 | | template <typename FormatContext> \ |
3774 | | FMT_CONSTEXPR auto format(Type value, FormatContext& ctx) const \ |
3775 | | -> decltype(ctx.out()) { \ |
3776 | | return formatter<Base, Char>::format(value, ctx); \ |
3777 | | } \ |
3778 | | } |
3779 | | |
3780 | | FMT_FORMAT_AS(signed char, int); |
3781 | | FMT_FORMAT_AS(unsigned char, unsigned); |
3782 | | FMT_FORMAT_AS(short, int); |
3783 | | FMT_FORMAT_AS(unsigned short, unsigned); |
3784 | | FMT_FORMAT_AS(long, detail::long_type); |
3785 | | FMT_FORMAT_AS(unsigned long, detail::ulong_type); |
3786 | | FMT_FORMAT_AS(Char*, const Char*); |
3787 | | FMT_FORMAT_AS(detail::std_string_view<Char>, basic_string_view<Char>); |
3788 | | FMT_FORMAT_AS(std::nullptr_t, const void*); |
3789 | | FMT_FORMAT_AS(void*, const void*); |
3790 | | |
3791 | | template <typename Char, size_t N> |
3792 | | struct formatter<Char[N], Char> : formatter<basic_string_view<Char>, Char> {}; |
3793 | | |
3794 | | template <typename Char, typename Traits, typename Allocator> |
3795 | | class formatter<std::basic_string<Char, Traits, Allocator>, Char> |
3796 | | : public formatter<basic_string_view<Char>, Char> {}; |
3797 | | |
3798 | | template <int N, typename Char> |
3799 | | struct formatter<detail::bitint<N>, Char> : formatter<long long, Char> {}; |
3800 | | template <int N, typename Char> |
3801 | | struct formatter<detail::ubitint<N>, Char> |
3802 | | : formatter<unsigned long long, Char> {}; |
3803 | | |
3804 | | template <typename Char> |
3805 | | struct formatter<detail::float128, Char> |
3806 | | : detail::native_formatter<detail::float128, Char, |
3807 | | detail::type::float_type> {}; |
3808 | | |
3809 | | template <typename T, typename Char> |
3810 | | struct formatter<T, Char, void_t<detail::format_as_result<T>>> |
3811 | | : formatter<detail::format_as_result<T>, Char> { |
3812 | | template <typename FormatContext> |
3813 | | FMT_CONSTEXPR auto format(const T& value, FormatContext& ctx) const |
3814 | | -> decltype(ctx.out()) { |
3815 | | auto&& val = format_as(value); // Make an lvalue reference for format. |
3816 | | return formatter<detail::format_as_result<T>, Char>::format(val, ctx); |
3817 | | } |
3818 | | }; |
3819 | | |
3820 | | /** |
3821 | | * Converts `p` to `const void*` for pointer formatting. |
3822 | | * |
3823 | | * **Example**: |
3824 | | * |
3825 | | * auto s = fmt::format("{}", fmt::ptr(p)); |
3826 | | */ |
3827 | | template <typename T> auto ptr(T p) -> const void* { |
3828 | | static_assert(std::is_pointer<T>::value, ""); |
3829 | | return detail::bit_cast<const void*>(p); |
3830 | | } |
3831 | | |
3832 | | /** |
3833 | | * Converts `e` to the underlying type. |
3834 | | * |
3835 | | * **Example**: |
3836 | | * |
3837 | | * enum class color { red, green, blue }; |
3838 | | * auto s = fmt::format("{}", fmt::underlying(color::red)); |
3839 | | */ |
3840 | | template <typename Enum> |
3841 | | constexpr auto underlying(Enum e) noexcept -> underlying_t<Enum> { |
3842 | | return static_cast<underlying_t<Enum>>(e); |
3843 | | } |
3844 | | |
3845 | | namespace enums { |
3846 | | template <typename Enum, FMT_ENABLE_IF(std::is_enum<Enum>::value)> |
3847 | | constexpr auto format_as(Enum e) noexcept -> underlying_t<Enum> { |
3848 | | return static_cast<underlying_t<Enum>>(e); |
3849 | | } |
3850 | | } // namespace enums |
3851 | | |
3852 | | #ifdef __cpp_lib_byte |
3853 | | template <> struct formatter<std::byte> : formatter<unsigned> { |
3854 | | static auto format_as(std::byte b) -> unsigned char { |
3855 | | return static_cast<unsigned char>(b); |
3856 | | } |
3857 | | template <typename Context> |
3858 | | auto format(std::byte b, Context& ctx) const -> decltype(ctx.out()) { |
3859 | | return formatter<unsigned>::format(format_as(b), ctx); |
3860 | | } |
3861 | | }; |
3862 | | #endif |
3863 | | |
3864 | | struct bytes { |
3865 | | string_view data; |
3866 | | |
3867 | 0 | inline explicit bytes(string_view s) : data(s) {} |
3868 | | }; |
3869 | | |
3870 | | template <> struct formatter<bytes> { |
3871 | | private: |
3872 | | detail::dynamic_format_specs<> specs_; |
3873 | | |
3874 | | public: |
3875 | 0 | FMT_CONSTEXPR auto parse(parse_context<>& ctx) -> const char* { |
3876 | 0 | return parse_format_specs(ctx.begin(), ctx.end(), specs_, ctx, |
3877 | 0 | detail::type::string_type); |
3878 | 0 | } |
3879 | | |
3880 | | template <typename FormatContext> |
3881 | | auto format(bytes b, FormatContext& ctx) const -> decltype(ctx.out()) { |
3882 | | auto specs = specs_; |
3883 | | detail::handle_dynamic_spec(specs.dynamic_width(), specs.width, |
3884 | | specs.width_ref, ctx); |
3885 | | detail::handle_dynamic_spec(specs.dynamic_precision(), specs.precision, |
3886 | | specs.precision_ref, ctx); |
3887 | | return detail::write_bytes<char>(ctx.out(), b.data, specs); |
3888 | | } |
3889 | | }; |
3890 | | |
3891 | | // group_digits_view is not derived from view because it copies the argument. |
3892 | | template <typename T> struct group_digits_view { |
3893 | | T value; |
3894 | | }; |
3895 | | |
3896 | | /** |
3897 | | * Returns a view that formats an integer value using ',' as a |
3898 | | * locale-independent thousands separator. |
3899 | | * |
3900 | | * **Example**: |
3901 | | * |
3902 | | * fmt::print("{}", fmt::group_digits(12345)); |
3903 | | * // Output: "12,345" |
3904 | | */ |
3905 | | template <typename T> auto group_digits(T value) -> group_digits_view<T> { |
3906 | | return {value}; |
3907 | | } |
3908 | | |
3909 | | template <typename T> struct formatter<group_digits_view<T>> : formatter<T> { |
3910 | | private: |
3911 | | detail::dynamic_format_specs<> specs_; |
3912 | | |
3913 | | public: |
3914 | | FMT_CONSTEXPR auto parse(parse_context<>& ctx) -> const char* { |
3915 | | return parse_format_specs(ctx.begin(), ctx.end(), specs_, ctx, |
3916 | | detail::type::int_type); |
3917 | | } |
3918 | | |
3919 | | template <typename FormatContext> |
3920 | | auto format(group_digits_view<T> t, FormatContext& ctx) const |
3921 | | -> decltype(ctx.out()) { |
3922 | | auto specs = specs_; |
3923 | | detail::handle_dynamic_spec(specs.dynamic_width(), specs.width, |
3924 | | specs.width_ref, ctx); |
3925 | | detail::handle_dynamic_spec(specs.dynamic_precision(), specs.precision, |
3926 | | specs.precision_ref, ctx); |
3927 | | auto arg = detail::make_write_int_arg(t.value, specs.sign()); |
3928 | | return detail::write_int( |
3929 | | ctx.out(), static_cast<detail::uint64_or_128_t<T>>(arg.abs_value), |
3930 | | arg.prefix, specs, detail::digit_grouping<char>("\3", ",")); |
3931 | | } |
3932 | | }; |
3933 | | |
3934 | | template <typename T, typename Char> struct nested_view { |
3935 | | const formatter<T, Char>* fmt; |
3936 | | const T* value; |
3937 | | }; |
3938 | | |
3939 | | template <typename T, typename Char> |
3940 | | struct formatter<nested_view<T, Char>, Char> { |
3941 | | FMT_CONSTEXPR auto parse(parse_context<Char>& ctx) -> const Char* { |
3942 | | return ctx.begin(); |
3943 | | } |
3944 | | template <typename FormatContext> |
3945 | | auto format(nested_view<T, Char> view, FormatContext& ctx) const |
3946 | | -> decltype(ctx.out()) { |
3947 | | return view.fmt->format(*view.value, ctx); |
3948 | | } |
3949 | | }; |
3950 | | |
3951 | | template <typename T, typename Char = char> struct nested_formatter { |
3952 | | private: |
3953 | | basic_specs specs_; |
3954 | | int width_; |
3955 | | formatter<T, Char> formatter_; |
3956 | | |
3957 | | public: |
3958 | | constexpr nested_formatter() : width_(0) {} |
3959 | | |
3960 | | FMT_CONSTEXPR auto parse(parse_context<Char>& ctx) -> const Char* { |
3961 | | auto it = ctx.begin(), end = ctx.end(); |
3962 | | if (it == end) return it; |
3963 | | auto specs = format_specs(); |
3964 | | it = detail::parse_align(it, end, specs); |
3965 | | specs_ = specs; |
3966 | | Char c = *it; |
3967 | | auto width_ref = detail::arg_ref<Char>(); |
3968 | | if ((c >= '0' && c <= '9') || c == '{') { |
3969 | | it = detail::parse_width(it, end, specs, width_ref, ctx); |
3970 | | width_ = specs.width; |
3971 | | } |
3972 | | ctx.advance_to(it); |
3973 | | return formatter_.parse(ctx); |
3974 | | } |
3975 | | |
3976 | | template <typename FormatContext, typename F> |
3977 | | auto write_padded(FormatContext& ctx, F write) const -> decltype(ctx.out()) { |
3978 | | if (width_ == 0) return write(ctx.out()); |
3979 | | auto buf = basic_memory_buffer<Char>(); |
3980 | | write(basic_appender<Char>(buf)); |
3981 | | auto specs = format_specs(); |
3982 | | specs.width = width_; |
3983 | | specs.set_fill( |
3984 | | basic_string_view<Char>(specs_.fill<Char>(), specs_.fill_size())); |
3985 | | specs.set_align(specs_.align()); |
3986 | | return detail::write<Char>( |
3987 | | ctx.out(), basic_string_view<Char>(buf.data(), buf.size()), specs); |
3988 | | } |
3989 | | |
3990 | | auto nested(const T& value) const -> nested_view<T, Char> { |
3991 | | return nested_view<T, Char>{&formatter_, &value}; |
3992 | | } |
3993 | | }; |
3994 | | |
3995 | | inline namespace literals { |
3996 | | #if FMT_USE_NONTYPE_TEMPLATE_ARGS |
3997 | | template <detail::fixed_string Str> constexpr auto operator""_a() { |
3998 | | using char_t = remove_cvref_t<decltype(Str.data[0])>; |
3999 | | return detail::udl_arg<char_t, sizeof(Str.data) / sizeof(char_t), Str>(); |
4000 | | } |
4001 | | #else |
4002 | | /** |
4003 | | * User-defined literal equivalent of `fmt::arg`. |
4004 | | * |
4005 | | * **Example**: |
4006 | | * |
4007 | | * using namespace fmt::literals; |
4008 | | * fmt::print("The answer is {answer}.", "answer"_a=42); |
4009 | | */ |
4010 | 0 | constexpr auto operator""_a(const char* s, size_t) -> detail::udl_arg<char> { |
4011 | 0 | return {s}; |
4012 | 0 | } |
4013 | | #endif // FMT_USE_NONTYPE_TEMPLATE_ARGS |
4014 | | } // namespace literals |
4015 | | |
4016 | | /// A fast integer formatter. |
4017 | | class format_int { |
4018 | | private: |
4019 | | // Buffer should be large enough to hold all digits (digits10 + 1), |
4020 | | // a sign and a null character. |
4021 | | enum { buffer_size = std::numeric_limits<unsigned long long>::digits10 + 3 }; |
4022 | | mutable char buffer_[buffer_size]; |
4023 | | char* str_; |
4024 | | |
4025 | | template <typename UInt> |
4026 | 0 | FMT_CONSTEXPR20 auto format_unsigned(UInt value) -> char* { |
4027 | 0 | auto n = static_cast<detail::uint32_or_64_or_128_t<UInt>>(value); |
4028 | 0 | return detail::do_format_decimal(buffer_, n, buffer_size - 1); |
4029 | 0 | } Unexecuted instantiation: char* fmt::v11::format_int::format_unsigned<unsigned int>(unsigned int) Unexecuted instantiation: char* fmt::v11::format_int::format_unsigned<unsigned long>(unsigned long) Unexecuted instantiation: char* fmt::v11::format_int::format_unsigned<unsigned long long>(unsigned long long) |
4030 | | |
4031 | | template <typename Int> |
4032 | 0 | FMT_CONSTEXPR20 auto format_signed(Int value) -> char* { |
4033 | 0 | auto abs_value = static_cast<detail::uint32_or_64_or_128_t<Int>>(value); |
4034 | 0 | bool negative = value < 0; |
4035 | 0 | if (negative) abs_value = 0 - abs_value; |
4036 | 0 | auto begin = format_unsigned(abs_value); |
4037 | 0 | if (negative) *--begin = '-'; |
4038 | 0 | return begin; |
4039 | 0 | } Unexecuted instantiation: char* fmt::v11::format_int::format_signed<int>(int) Unexecuted instantiation: char* fmt::v11::format_int::format_signed<long>(long) Unexecuted instantiation: char* fmt::v11::format_int::format_signed<long long>(long long) |
4040 | | |
4041 | | public: |
4042 | 0 | explicit FMT_CONSTEXPR20 format_int(int value) : str_(format_signed(value)) {} |
4043 | | explicit FMT_CONSTEXPR20 format_int(long value) |
4044 | 0 | : str_(format_signed(value)) {} |
4045 | | explicit FMT_CONSTEXPR20 format_int(long long value) |
4046 | 0 | : str_(format_signed(value)) {} |
4047 | | explicit FMT_CONSTEXPR20 format_int(unsigned value) |
4048 | 0 | : str_(format_unsigned(value)) {} |
4049 | | explicit FMT_CONSTEXPR20 format_int(unsigned long value) |
4050 | 0 | : str_(format_unsigned(value)) {} |
4051 | | explicit FMT_CONSTEXPR20 format_int(unsigned long long value) |
4052 | 0 | : str_(format_unsigned(value)) {} |
4053 | | |
4054 | | /// Returns the number of characters written to the output buffer. |
4055 | 0 | FMT_CONSTEXPR20 auto size() const -> size_t { |
4056 | 0 | return detail::to_unsigned(buffer_ - str_ + buffer_size - 1); |
4057 | 0 | } |
4058 | | |
4059 | | /// Returns a pointer to the output buffer content. No terminating null |
4060 | | /// character is appended. |
4061 | 0 | FMT_CONSTEXPR20 auto data() const -> const char* { return str_; } |
4062 | | |
4063 | | /// Returns a pointer to the output buffer content with terminating null |
4064 | | /// character appended. |
4065 | 0 | FMT_CONSTEXPR20 auto c_str() const -> const char* { |
4066 | 0 | buffer_[buffer_size - 1] = '\0'; |
4067 | 0 | return str_; |
4068 | 0 | } |
4069 | | |
4070 | | /// Returns the content of the output buffer as an `std::string`. |
4071 | 0 | inline auto str() const -> std::string { return {str_, size()}; } |
4072 | | }; |
4073 | | |
4074 | | #define FMT_STRING_IMPL(s, base) \ |
4075 | 150k | [] { \ |
4076 | 150k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ |
4077 | 150k | /* Use a macro-like name to avoid shadowing warnings. */ \ |
4078 | 150k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ |
4079 | 150k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ |
4080 | 150k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ |
4081 | 301k | const { \ |
4082 | 301k | return fmt::detail::compile_string_to_view<char_type>(s); \ |
4083 | 301k | } \ Unexecuted instantiation: format.cc:fmt::v11::detail::format_error_code(fmt::v11::detail::buffer<char>&, int, fmt::v11::basic_string_view<char>)::$_0::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Unexecuted instantiation: format.cc:fmt::v11::detail::format_error_code(fmt::v11::detail::buffer<char>&, int, fmt::v11::basic_string_view<char>)::$_1::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Unexecuted instantiation: fmt::v11::formatter<fmt::v11::detail::bigint, char, void>::format(fmt::v11::detail::bigint const&, fmt::v11::context&) const::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Unexecuted instantiation: fmt::v11::formatter<fmt::v11::detail::bigint, char, void>::format(fmt::v11::detail::bigint const&, fmt::v11::context&) const::{lambda()#2}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Unexecuted instantiation: fmt::v11::formatter<fmt::v11::detail::bigint, char, void>::format(fmt::v11::detail::bigint const&, fmt::v11::context&) const::{lambda()#3}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Unexecuted instantiation: fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<long long, std::__1::ratio<1l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Unexecuted instantiation: fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<float, std::__1::ratio<1l, 1000000000000000000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<float, std::__1::ratio<1l, 1000000000000000000l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 6.73k | const { \ | 4082 | 6.73k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 6.73k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<float, std::__1::ratio<1l, 1000000000000000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<float, std::__1::ratio<1l, 1000000000000000l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 6.54k | const { \ | 4082 | 6.54k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 6.54k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<float, std::__1::ratio<1l, 1000000000000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<float, std::__1::ratio<1l, 1000000000000l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 6.83k | const { \ | 4082 | 6.83k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 6.83k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<float, std::__1::ratio<1l, 1000000000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<float, std::__1::ratio<1l, 1000000000l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 6.67k | const { \ | 4082 | 6.67k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 6.67k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<float, std::__1::ratio<1l, 1000000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<float, std::__1::ratio<1l, 1000000l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 6.78k | const { \ | 4082 | 6.78k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 6.78k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<float, std::__1::ratio<1l, 1000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<float, std::__1::ratio<1l, 1000l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 7.81k | const { \ | 4082 | 7.81k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 7.81k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<float, std::__1::ratio<1l, 100l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<float, std::__1::ratio<1l, 100l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 4.71k | const { \ | 4082 | 4.71k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 4.71k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<float, std::__1::ratio<1l, 10l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<float, std::__1::ratio<1l, 10l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 8.50k | const { \ | 4082 | 8.50k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 8.50k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<float, std::__1::ratio<10l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<float, std::__1::ratio<10l, 1l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 5.92k | const { \ | 4082 | 5.92k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 5.92k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<float, std::__1::ratio<1000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<float, std::__1::ratio<1000l, 1l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 6.51k | const { \ | 4082 | 6.51k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 6.51k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<float, std::__1::ratio<1000000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<float, std::__1::ratio<1000000l, 1l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 6.79k | const { \ | 4082 | 6.79k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 6.79k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<float, std::__1::ratio<1000000000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<float, std::__1::ratio<1000000000l, 1l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 6.49k | const { \ | 4082 | 6.49k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 6.49k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<float, std::__1::ratio<1000000000000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<float, std::__1::ratio<1000000000000l, 1l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 6.85k | const { \ | 4082 | 6.85k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 6.85k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<float, std::__1::ratio<1000000000000000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<float, std::__1::ratio<1000000000000000l, 1l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 6.41k | const { \ | 4082 | 6.41k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 6.41k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<float, std::__1::ratio<1000000000000000000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<float, std::__1::ratio<1000000000000000000l, 1l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 6.63k | const { \ | 4082 | 6.63k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 6.63k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<double, std::__1::ratio<1l, 1000000000000000000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<double, std::__1::ratio<1l, 1000000000000000000l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 6.82k | const { \ | 4082 | 6.82k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 6.82k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<double, std::__1::ratio<1l, 1000000000000000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<double, std::__1::ratio<1l, 1000000000000000l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 7.23k | const { \ | 4082 | 7.23k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 7.23k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<double, std::__1::ratio<1l, 1000000000000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<double, std::__1::ratio<1l, 1000000000000l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 5.82k | const { \ | 4082 | 5.82k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 5.82k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<double, std::__1::ratio<1l, 1000000000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<double, std::__1::ratio<1l, 1000000000l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 5.16k | const { \ | 4082 | 5.16k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 5.16k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<double, std::__1::ratio<1l, 1000000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<double, std::__1::ratio<1l, 1000000l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 7.34k | const { \ | 4082 | 7.34k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 7.34k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<double, std::__1::ratio<1l, 1000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<double, std::__1::ratio<1l, 1000l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 7.28k | const { \ | 4082 | 7.28k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 7.28k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<double, std::__1::ratio<1l, 100l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<double, std::__1::ratio<1l, 100l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 7.46k | const { \ | 4082 | 7.46k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 7.46k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<double, std::__1::ratio<1l, 10l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<double, std::__1::ratio<1l, 10l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 5.97k | const { \ | 4082 | 5.97k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 5.97k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<double, std::__1::ratio<10l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<double, std::__1::ratio<10l, 1l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 8.10k | const { \ | 4082 | 8.10k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 8.10k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<double, std::__1::ratio<1000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<double, std::__1::ratio<1000l, 1l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 5.40k | const { \ | 4082 | 5.40k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 5.40k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<double, std::__1::ratio<1000000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<double, std::__1::ratio<1000000l, 1l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 8.67k | const { \ | 4082 | 8.67k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 8.67k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<double, std::__1::ratio<1000000000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<double, std::__1::ratio<1000000000l, 1l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 7.54k | const { \ | 4082 | 7.54k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 7.54k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<double, std::__1::ratio<1000000000000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<double, std::__1::ratio<1000000000000l, 1l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 9.03k | const { \ | 4082 | 9.03k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 9.03k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<double, std::__1::ratio<1000000000000000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<double, std::__1::ratio<1000000000000000l, 1l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 4.55k | const { \ | 4082 | 4.55k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 4.55k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<double, std::__1::ratio<1000000000000000000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<double, std::__1::ratio<1000000000000000000l, 1l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 5.26k | const { \ | 4082 | 5.26k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 5.26k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<long double, std::__1::ratio<1l, 1000000000000000000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<long double, std::__1::ratio<1l, 1000000000000000000l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 6.41k | const { \ | 4082 | 6.41k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 6.41k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<long double, std::__1::ratio<1l, 1000000000000000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<long double, std::__1::ratio<1l, 1000000000000000l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 6.75k | const { \ | 4082 | 6.75k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 6.75k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<long double, std::__1::ratio<1l, 1000000000000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<long double, std::__1::ratio<1l, 1000000000000l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 6.47k | const { \ | 4082 | 6.47k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 6.47k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<long double, std::__1::ratio<1l, 1000000000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<long double, std::__1::ratio<1l, 1000000000l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 6.06k | const { \ | 4082 | 6.06k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 6.06k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<long double, std::__1::ratio<1l, 1000000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<long double, std::__1::ratio<1l, 1000000l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 7.31k | const { \ | 4082 | 7.31k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 7.31k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<long double, std::__1::ratio<1l, 1000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<long double, std::__1::ratio<1l, 1000l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 7.89k | const { \ | 4082 | 7.89k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 7.89k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<long double, std::__1::ratio<1l, 100l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<long double, std::__1::ratio<1l, 100l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 6.90k | const { \ | 4082 | 6.90k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 6.90k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<long double, std::__1::ratio<1l, 10l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<long double, std::__1::ratio<1l, 10l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 7.55k | const { \ | 4082 | 7.55k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 7.55k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<long double, std::__1::ratio<10l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<long double, std::__1::ratio<10l, 1l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 6.59k | const { \ | 4082 | 6.59k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 6.59k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<long double, std::__1::ratio<1000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<long double, std::__1::ratio<1000l, 1l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 4.94k | const { \ | 4082 | 4.94k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 4.94k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<long double, std::__1::ratio<1000000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<long double, std::__1::ratio<1000000l, 1l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 6.49k | const { \ | 4082 | 6.49k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 6.49k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<long double, std::__1::ratio<1000000000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<long double, std::__1::ratio<1000000000l, 1l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 9.39k | const { \ | 4082 | 9.39k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 9.39k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<long double, std::__1::ratio<1000000000000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<long double, std::__1::ratio<1000000000000l, 1l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 6.58k | const { \ | 4082 | 6.58k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 6.58k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<long double, std::__1::ratio<1000000000000000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<long double, std::__1::ratio<1000000000000000l, 1l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 4.50k | const { \ | 4082 | 4.50k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 4.50k | } \ |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<long double, std::__1::ratio<1000000000000000000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<long double, std::__1::ratio<1000000000000000000l, 1l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Line | Count | Source | 4081 | 5.72k | const { \ | 4082 | 5.72k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 5.72k | } \ |
Unexecuted instantiation: fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<unsigned int, std::__1::ratio<1l, 1000000000000000000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<unsigned int, std::__1::ratio<1l, 1000000000000000000l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Unexecuted instantiation: fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<unsigned int, std::__1::ratio<1l, 1000000000000000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<unsigned int, std::__1::ratio<1l, 1000000000000000l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Unexecuted instantiation: fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<unsigned int, std::__1::ratio<1l, 1000000000000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<unsigned int, std::__1::ratio<1l, 1000000000000l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Unexecuted instantiation: fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<unsigned int, std::__1::ratio<1l, 1000000000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<unsigned int, std::__1::ratio<1l, 1000000000l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Unexecuted instantiation: fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<unsigned int, std::__1::ratio<1l, 1000000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<unsigned int, std::__1::ratio<1l, 1000000l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Unexecuted instantiation: fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<unsigned int, std::__1::ratio<1l, 1000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<unsigned int, std::__1::ratio<1l, 1000l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Unexecuted instantiation: fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<unsigned int, std::__1::ratio<1l, 100l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<unsigned int, std::__1::ratio<1l, 100l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Unexecuted instantiation: fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<unsigned int, std::__1::ratio<1l, 10l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<unsigned int, std::__1::ratio<1l, 10l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Unexecuted instantiation: fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<unsigned int, std::__1::ratio<10l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<unsigned int, std::__1::ratio<10l, 1l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Unexecuted instantiation: fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<unsigned int, std::__1::ratio<1000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<unsigned int, std::__1::ratio<1000l, 1l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Unexecuted instantiation: fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<unsigned int, std::__1::ratio<1000000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<unsigned int, std::__1::ratio<1000000l, 1l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Unexecuted instantiation: fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<unsigned int, std::__1::ratio<1000000000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<unsigned int, std::__1::ratio<1000000000l, 1l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Unexecuted instantiation: fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<unsigned int, std::__1::ratio<1000000000000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<unsigned int, std::__1::ratio<1000000000000l, 1l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Unexecuted instantiation: fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<unsigned int, std::__1::ratio<1000000000000000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<unsigned int, std::__1::ratio<1000000000000000l, 1l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Unexecuted instantiation: fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<unsigned int, std::__1::ratio<1000000000000000000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<unsigned int, std::__1::ratio<1000000000000000000l, 1l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Unexecuted instantiation: fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<unsigned long, std::__1::ratio<1l, 1000000000000000000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<unsigned long, std::__1::ratio<1l, 1000000000000000000l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Unexecuted instantiation: fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<unsigned long, std::__1::ratio<1l, 1000000000000000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<unsigned long, std::__1::ratio<1l, 1000000000000000l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Unexecuted instantiation: fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<unsigned long, std::__1::ratio<1l, 1000000000000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<unsigned long, std::__1::ratio<1l, 1000000000000l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Unexecuted instantiation: fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<unsigned long, std::__1::ratio<1l, 1000000000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<unsigned long, std::__1::ratio<1l, 1000000000l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Unexecuted instantiation: fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<unsigned long, std::__1::ratio<1l, 1000000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<unsigned long, std::__1::ratio<1l, 1000000l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Unexecuted instantiation: fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<unsigned long, std::__1::ratio<1l, 1000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<unsigned long, std::__1::ratio<1l, 1000l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Unexecuted instantiation: fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<unsigned long, std::__1::ratio<1l, 100l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<unsigned long, std::__1::ratio<1l, 100l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Unexecuted instantiation: fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<unsigned long, std::__1::ratio<1l, 10l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<unsigned long, std::__1::ratio<1l, 10l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Unexecuted instantiation: fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<unsigned long, std::__1::ratio<10l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<unsigned long, std::__1::ratio<10l, 1l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Unexecuted instantiation: fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<unsigned long, std::__1::ratio<1000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<unsigned long, std::__1::ratio<1000l, 1l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Unexecuted instantiation: fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<unsigned long, std::__1::ratio<1000000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<unsigned long, std::__1::ratio<1000000l, 1l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Unexecuted instantiation: fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<unsigned long, std::__1::ratio<1000000000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<unsigned long, std::__1::ratio<1000000000l, 1l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Unexecuted instantiation: fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<unsigned long, std::__1::ratio<1000000000000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<unsigned long, std::__1::ratio<1000000000000l, 1l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Unexecuted instantiation: fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<unsigned long, std::__1::ratio<1000000000000000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<unsigned long, std::__1::ratio<1000000000000000l, 1l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const Unexecuted instantiation: fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<unsigned long, std::__1::ratio<1000000000000000000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<unsigned long, std::__1::ratio<1000000000000000000l, 1l> >, int)::{lambda()#1}::operator()() const::FMT_COMPILE_STRING::operator fmt::v11::basic_string_view<char>() const |
4084 | 150k | }; \ |
4085 | 150k | using FMT_STRING_VIEW = \ |
4086 | 150k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ |
4087 | 150k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ |
4088 | 150k | return FMT_COMPILE_STRING(); \ |
4089 | 150k | }() Unexecuted instantiation: format.cc:fmt::v11::detail::format_error_code(fmt::v11::detail::buffer<char>&, int, fmt::v11::basic_string_view<char>)::$_0::operator()() const Unexecuted instantiation: format.cc:fmt::v11::detail::format_error_code(fmt::v11::detail::buffer<char>&, int, fmt::v11::basic_string_view<char>)::$_1::operator()() const fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<float, std::__1::ratio<1l, 1000000000000000000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<float, std::__1::ratio<1l, 1000000000000000000l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 3.36k | [] { \ | 4076 | 3.36k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 3.36k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 3.36k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 3.36k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 3.36k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 3.36k | const { \ | 4082 | 3.36k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 3.36k | } \ | 4084 | 3.36k | }; \ | 4085 | 3.36k | using FMT_STRING_VIEW = \ | 4086 | 3.36k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 3.36k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 3.36k | return FMT_COMPILE_STRING(); \ | 4089 | 3.36k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<float, std::__1::ratio<1l, 1000000000000000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<float, std::__1::ratio<1l, 1000000000000000l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 3.27k | [] { \ | 4076 | 3.27k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 3.27k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 3.27k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 3.27k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 3.27k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 3.27k | const { \ | 4082 | 3.27k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 3.27k | } \ | 4084 | 3.27k | }; \ | 4085 | 3.27k | using FMT_STRING_VIEW = \ | 4086 | 3.27k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 3.27k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 3.27k | return FMT_COMPILE_STRING(); \ | 4089 | 3.27k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<float, std::__1::ratio<1l, 1000000000000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<float, std::__1::ratio<1l, 1000000000000l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 3.41k | [] { \ | 4076 | 3.41k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 3.41k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 3.41k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 3.41k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 3.41k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 3.41k | const { \ | 4082 | 3.41k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 3.41k | } \ | 4084 | 3.41k | }; \ | 4085 | 3.41k | using FMT_STRING_VIEW = \ | 4086 | 3.41k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 3.41k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 3.41k | return FMT_COMPILE_STRING(); \ | 4089 | 3.41k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<float, std::__1::ratio<1l, 1000000000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<float, std::__1::ratio<1l, 1000000000l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 3.33k | [] { \ | 4076 | 3.33k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 3.33k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 3.33k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 3.33k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 3.33k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 3.33k | const { \ | 4082 | 3.33k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 3.33k | } \ | 4084 | 3.33k | }; \ | 4085 | 3.33k | using FMT_STRING_VIEW = \ | 4086 | 3.33k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 3.33k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 3.33k | return FMT_COMPILE_STRING(); \ | 4089 | 3.33k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<float, std::__1::ratio<1l, 1000000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<float, std::__1::ratio<1l, 1000000l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 3.39k | [] { \ | 4076 | 3.39k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 3.39k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 3.39k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 3.39k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 3.39k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 3.39k | const { \ | 4082 | 3.39k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 3.39k | } \ | 4084 | 3.39k | }; \ | 4085 | 3.39k | using FMT_STRING_VIEW = \ | 4086 | 3.39k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 3.39k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 3.39k | return FMT_COMPILE_STRING(); \ | 4089 | 3.39k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<float, std::__1::ratio<1l, 1000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<float, std::__1::ratio<1l, 1000l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 3.90k | [] { \ | 4076 | 3.90k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 3.90k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 3.90k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 3.90k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 3.90k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 3.90k | const { \ | 4082 | 3.90k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 3.90k | } \ | 4084 | 3.90k | }; \ | 4085 | 3.90k | using FMT_STRING_VIEW = \ | 4086 | 3.90k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 3.90k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 3.90k | return FMT_COMPILE_STRING(); \ | 4089 | 3.90k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<float, std::__1::ratio<1l, 100l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<float, std::__1::ratio<1l, 100l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 2.35k | [] { \ | 4076 | 2.35k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 2.35k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 2.35k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 2.35k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 2.35k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 2.35k | const { \ | 4082 | 2.35k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 2.35k | } \ | 4084 | 2.35k | }; \ | 4085 | 2.35k | using FMT_STRING_VIEW = \ | 4086 | 2.35k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 2.35k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 2.35k | return FMT_COMPILE_STRING(); \ | 4089 | 2.35k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<float, std::__1::ratio<1l, 10l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<float, std::__1::ratio<1l, 10l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 4.25k | [] { \ | 4076 | 4.25k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 4.25k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 4.25k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 4.25k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 4.25k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 4.25k | const { \ | 4082 | 4.25k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 4.25k | } \ | 4084 | 4.25k | }; \ | 4085 | 4.25k | using FMT_STRING_VIEW = \ | 4086 | 4.25k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 4.25k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 4.25k | return FMT_COMPILE_STRING(); \ | 4089 | 4.25k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<float, std::__1::ratio<10l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<float, std::__1::ratio<10l, 1l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 2.96k | [] { \ | 4076 | 2.96k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 2.96k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 2.96k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 2.96k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 2.96k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 2.96k | const { \ | 4082 | 2.96k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 2.96k | } \ | 4084 | 2.96k | }; \ | 4085 | 2.96k | using FMT_STRING_VIEW = \ | 4086 | 2.96k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 2.96k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 2.96k | return FMT_COMPILE_STRING(); \ | 4089 | 2.96k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<float, std::__1::ratio<1000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<float, std::__1::ratio<1000l, 1l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 3.25k | [] { \ | 4076 | 3.25k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 3.25k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 3.25k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 3.25k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 3.25k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 3.25k | const { \ | 4082 | 3.25k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 3.25k | } \ | 4084 | 3.25k | }; \ | 4085 | 3.25k | using FMT_STRING_VIEW = \ | 4086 | 3.25k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 3.25k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 3.25k | return FMT_COMPILE_STRING(); \ | 4089 | 3.25k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<float, std::__1::ratio<1000000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<float, std::__1::ratio<1000000l, 1l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 3.39k | [] { \ | 4076 | 3.39k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 3.39k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 3.39k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 3.39k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 3.39k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 3.39k | const { \ | 4082 | 3.39k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 3.39k | } \ | 4084 | 3.39k | }; \ | 4085 | 3.39k | using FMT_STRING_VIEW = \ | 4086 | 3.39k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 3.39k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 3.39k | return FMT_COMPILE_STRING(); \ | 4089 | 3.39k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<float, std::__1::ratio<1000000000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<float, std::__1::ratio<1000000000l, 1l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 3.24k | [] { \ | 4076 | 3.24k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 3.24k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 3.24k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 3.24k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 3.24k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 3.24k | const { \ | 4082 | 3.24k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 3.24k | } \ | 4084 | 3.24k | }; \ | 4085 | 3.24k | using FMT_STRING_VIEW = \ | 4086 | 3.24k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 3.24k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 3.24k | return FMT_COMPILE_STRING(); \ | 4089 | 3.24k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<float, std::__1::ratio<1000000000000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<float, std::__1::ratio<1000000000000l, 1l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 3.42k | [] { \ | 4076 | 3.42k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 3.42k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 3.42k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 3.42k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 3.42k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 3.42k | const { \ | 4082 | 3.42k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 3.42k | } \ | 4084 | 3.42k | }; \ | 4085 | 3.42k | using FMT_STRING_VIEW = \ | 4086 | 3.42k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 3.42k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 3.42k | return FMT_COMPILE_STRING(); \ | 4089 | 3.42k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<float, std::__1::ratio<1000000000000000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<float, std::__1::ratio<1000000000000000l, 1l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 3.20k | [] { \ | 4076 | 3.20k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 3.20k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 3.20k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 3.20k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 3.20k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 3.20k | const { \ | 4082 | 3.20k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 3.20k | } \ | 4084 | 3.20k | }; \ | 4085 | 3.20k | using FMT_STRING_VIEW = \ | 4086 | 3.20k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 3.20k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 3.20k | return FMT_COMPILE_STRING(); \ | 4089 | 3.20k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<float, std::__1::ratio<1000000000000000000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<float, std::__1::ratio<1000000000000000000l, 1l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 3.31k | [] { \ | 4076 | 3.31k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 3.31k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 3.31k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 3.31k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 3.31k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 3.31k | const { \ | 4082 | 3.31k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 3.31k | } \ | 4084 | 3.31k | }; \ | 4085 | 3.31k | using FMT_STRING_VIEW = \ | 4086 | 3.31k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 3.31k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 3.31k | return FMT_COMPILE_STRING(); \ | 4089 | 3.31k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<double, std::__1::ratio<1l, 1000000000000000000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<double, std::__1::ratio<1l, 1000000000000000000l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 3.41k | [] { \ | 4076 | 3.41k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 3.41k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 3.41k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 3.41k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 3.41k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 3.41k | const { \ | 4082 | 3.41k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 3.41k | } \ | 4084 | 3.41k | }; \ | 4085 | 3.41k | using FMT_STRING_VIEW = \ | 4086 | 3.41k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 3.41k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 3.41k | return FMT_COMPILE_STRING(); \ | 4089 | 3.41k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<double, std::__1::ratio<1l, 1000000000000000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<double, std::__1::ratio<1l, 1000000000000000l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 3.61k | [] { \ | 4076 | 3.61k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 3.61k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 3.61k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 3.61k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 3.61k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 3.61k | const { \ | 4082 | 3.61k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 3.61k | } \ | 4084 | 3.61k | }; \ | 4085 | 3.61k | using FMT_STRING_VIEW = \ | 4086 | 3.61k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 3.61k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 3.61k | return FMT_COMPILE_STRING(); \ | 4089 | 3.61k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<double, std::__1::ratio<1l, 1000000000000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<double, std::__1::ratio<1l, 1000000000000l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 2.91k | [] { \ | 4076 | 2.91k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 2.91k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 2.91k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 2.91k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 2.91k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 2.91k | const { \ | 4082 | 2.91k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 2.91k | } \ | 4084 | 2.91k | }; \ | 4085 | 2.91k | using FMT_STRING_VIEW = \ | 4086 | 2.91k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 2.91k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 2.91k | return FMT_COMPILE_STRING(); \ | 4089 | 2.91k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<double, std::__1::ratio<1l, 1000000000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<double, std::__1::ratio<1l, 1000000000l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 2.58k | [] { \ | 4076 | 2.58k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 2.58k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 2.58k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 2.58k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 2.58k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 2.58k | const { \ | 4082 | 2.58k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 2.58k | } \ | 4084 | 2.58k | }; \ | 4085 | 2.58k | using FMT_STRING_VIEW = \ | 4086 | 2.58k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 2.58k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 2.58k | return FMT_COMPILE_STRING(); \ | 4089 | 2.58k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<double, std::__1::ratio<1l, 1000000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<double, std::__1::ratio<1l, 1000000l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 3.67k | [] { \ | 4076 | 3.67k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 3.67k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 3.67k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 3.67k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 3.67k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 3.67k | const { \ | 4082 | 3.67k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 3.67k | } \ | 4084 | 3.67k | }; \ | 4085 | 3.67k | using FMT_STRING_VIEW = \ | 4086 | 3.67k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 3.67k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 3.67k | return FMT_COMPILE_STRING(); \ | 4089 | 3.67k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<double, std::__1::ratio<1l, 1000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<double, std::__1::ratio<1l, 1000l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 3.64k | [] { \ | 4076 | 3.64k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 3.64k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 3.64k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 3.64k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 3.64k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 3.64k | const { \ | 4082 | 3.64k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 3.64k | } \ | 4084 | 3.64k | }; \ | 4085 | 3.64k | using FMT_STRING_VIEW = \ | 4086 | 3.64k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 3.64k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 3.64k | return FMT_COMPILE_STRING(); \ | 4089 | 3.64k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<double, std::__1::ratio<1l, 100l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<double, std::__1::ratio<1l, 100l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 3.73k | [] { \ | 4076 | 3.73k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 3.73k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 3.73k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 3.73k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 3.73k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 3.73k | const { \ | 4082 | 3.73k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 3.73k | } \ | 4084 | 3.73k | }; \ | 4085 | 3.73k | using FMT_STRING_VIEW = \ | 4086 | 3.73k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 3.73k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 3.73k | return FMT_COMPILE_STRING(); \ | 4089 | 3.73k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<double, std::__1::ratio<1l, 10l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<double, std::__1::ratio<1l, 10l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 2.98k | [] { \ | 4076 | 2.98k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 2.98k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 2.98k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 2.98k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 2.98k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 2.98k | const { \ | 4082 | 2.98k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 2.98k | } \ | 4084 | 2.98k | }; \ | 4085 | 2.98k | using FMT_STRING_VIEW = \ | 4086 | 2.98k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 2.98k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 2.98k | return FMT_COMPILE_STRING(); \ | 4089 | 2.98k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<double, std::__1::ratio<10l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<double, std::__1::ratio<10l, 1l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 4.05k | [] { \ | 4076 | 4.05k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 4.05k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 4.05k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 4.05k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 4.05k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 4.05k | const { \ | 4082 | 4.05k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 4.05k | } \ | 4084 | 4.05k | }; \ | 4085 | 4.05k | using FMT_STRING_VIEW = \ | 4086 | 4.05k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 4.05k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 4.05k | return FMT_COMPILE_STRING(); \ | 4089 | 4.05k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<double, std::__1::ratio<1000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<double, std::__1::ratio<1000l, 1l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 2.70k | [] { \ | 4076 | 2.70k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 2.70k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 2.70k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 2.70k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 2.70k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 2.70k | const { \ | 4082 | 2.70k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 2.70k | } \ | 4084 | 2.70k | }; \ | 4085 | 2.70k | using FMT_STRING_VIEW = \ | 4086 | 2.70k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 2.70k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 2.70k | return FMT_COMPILE_STRING(); \ | 4089 | 2.70k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<double, std::__1::ratio<1000000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<double, std::__1::ratio<1000000l, 1l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 4.33k | [] { \ | 4076 | 4.33k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 4.33k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 4.33k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 4.33k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 4.33k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 4.33k | const { \ | 4082 | 4.33k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 4.33k | } \ | 4084 | 4.33k | }; \ | 4085 | 4.33k | using FMT_STRING_VIEW = \ | 4086 | 4.33k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 4.33k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 4.33k | return FMT_COMPILE_STRING(); \ | 4089 | 4.33k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<double, std::__1::ratio<1000000000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<double, std::__1::ratio<1000000000l, 1l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 3.77k | [] { \ | 4076 | 3.77k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 3.77k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 3.77k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 3.77k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 3.77k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 3.77k | const { \ | 4082 | 3.77k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 3.77k | } \ | 4084 | 3.77k | }; \ | 4085 | 3.77k | using FMT_STRING_VIEW = \ | 4086 | 3.77k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 3.77k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 3.77k | return FMT_COMPILE_STRING(); \ | 4089 | 3.77k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<double, std::__1::ratio<1000000000000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<double, std::__1::ratio<1000000000000l, 1l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 4.51k | [] { \ | 4076 | 4.51k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 4.51k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 4.51k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 4.51k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 4.51k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 4.51k | const { \ | 4082 | 4.51k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 4.51k | } \ | 4084 | 4.51k | }; \ | 4085 | 4.51k | using FMT_STRING_VIEW = \ | 4086 | 4.51k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 4.51k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 4.51k | return FMT_COMPILE_STRING(); \ | 4089 | 4.51k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<double, std::__1::ratio<1000000000000000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<double, std::__1::ratio<1000000000000000l, 1l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 2.27k | [] { \ | 4076 | 2.27k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 2.27k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 2.27k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 2.27k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 2.27k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 2.27k | const { \ | 4082 | 2.27k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 2.27k | } \ | 4084 | 2.27k | }; \ | 4085 | 2.27k | using FMT_STRING_VIEW = \ | 4086 | 2.27k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 2.27k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 2.27k | return FMT_COMPILE_STRING(); \ | 4089 | 2.27k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<double, std::__1::ratio<1000000000000000000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<double, std::__1::ratio<1000000000000000000l, 1l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 2.63k | [] { \ | 4076 | 2.63k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 2.63k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 2.63k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 2.63k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 2.63k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 2.63k | const { \ | 4082 | 2.63k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 2.63k | } \ | 4084 | 2.63k | }; \ | 4085 | 2.63k | using FMT_STRING_VIEW = \ | 4086 | 2.63k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 2.63k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 2.63k | return FMT_COMPILE_STRING(); \ | 4089 | 2.63k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<long double, std::__1::ratio<1l, 1000000000000000000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<long double, std::__1::ratio<1l, 1000000000000000000l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 3.20k | [] { \ | 4076 | 3.20k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 3.20k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 3.20k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 3.20k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 3.20k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 3.20k | const { \ | 4082 | 3.20k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 3.20k | } \ | 4084 | 3.20k | }; \ | 4085 | 3.20k | using FMT_STRING_VIEW = \ | 4086 | 3.20k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 3.20k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 3.20k | return FMT_COMPILE_STRING(); \ | 4089 | 3.20k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<long double, std::__1::ratio<1l, 1000000000000000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<long double, std::__1::ratio<1l, 1000000000000000l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 3.37k | [] { \ | 4076 | 3.37k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 3.37k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 3.37k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 3.37k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 3.37k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 3.37k | const { \ | 4082 | 3.37k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 3.37k | } \ | 4084 | 3.37k | }; \ | 4085 | 3.37k | using FMT_STRING_VIEW = \ | 4086 | 3.37k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 3.37k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 3.37k | return FMT_COMPILE_STRING(); \ | 4089 | 3.37k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<long double, std::__1::ratio<1l, 1000000000000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<long double, std::__1::ratio<1l, 1000000000000l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 3.23k | [] { \ | 4076 | 3.23k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 3.23k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 3.23k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 3.23k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 3.23k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 3.23k | const { \ | 4082 | 3.23k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 3.23k | } \ | 4084 | 3.23k | }; \ | 4085 | 3.23k | using FMT_STRING_VIEW = \ | 4086 | 3.23k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 3.23k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 3.23k | return FMT_COMPILE_STRING(); \ | 4089 | 3.23k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<long double, std::__1::ratio<1l, 1000000000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<long double, std::__1::ratio<1l, 1000000000l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 3.03k | [] { \ | 4076 | 3.03k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 3.03k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 3.03k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 3.03k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 3.03k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 3.03k | const { \ | 4082 | 3.03k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 3.03k | } \ | 4084 | 3.03k | }; \ | 4085 | 3.03k | using FMT_STRING_VIEW = \ | 4086 | 3.03k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 3.03k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 3.03k | return FMT_COMPILE_STRING(); \ | 4089 | 3.03k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<long double, std::__1::ratio<1l, 1000000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<long double, std::__1::ratio<1l, 1000000l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 3.65k | [] { \ | 4076 | 3.65k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 3.65k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 3.65k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 3.65k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 3.65k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 3.65k | const { \ | 4082 | 3.65k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 3.65k | } \ | 4084 | 3.65k | }; \ | 4085 | 3.65k | using FMT_STRING_VIEW = \ | 4086 | 3.65k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 3.65k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 3.65k | return FMT_COMPILE_STRING(); \ | 4089 | 3.65k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<long double, std::__1::ratio<1l, 1000l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<long double, std::__1::ratio<1l, 1000l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 3.94k | [] { \ | 4076 | 3.94k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 3.94k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 3.94k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 3.94k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 3.94k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 3.94k | const { \ | 4082 | 3.94k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 3.94k | } \ | 4084 | 3.94k | }; \ | 4085 | 3.94k | using FMT_STRING_VIEW = \ | 4086 | 3.94k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 3.94k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 3.94k | return FMT_COMPILE_STRING(); \ | 4089 | 3.94k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<long double, std::__1::ratio<1l, 100l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<long double, std::__1::ratio<1l, 100l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 3.45k | [] { \ | 4076 | 3.45k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 3.45k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 3.45k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 3.45k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 3.45k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 3.45k | const { \ | 4082 | 3.45k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 3.45k | } \ | 4084 | 3.45k | }; \ | 4085 | 3.45k | using FMT_STRING_VIEW = \ | 4086 | 3.45k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 3.45k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 3.45k | return FMT_COMPILE_STRING(); \ | 4089 | 3.45k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<long double, std::__1::ratio<1l, 10l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<long double, std::__1::ratio<1l, 10l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 3.77k | [] { \ | 4076 | 3.77k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 3.77k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 3.77k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 3.77k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 3.77k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 3.77k | const { \ | 4082 | 3.77k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 3.77k | } \ | 4084 | 3.77k | }; \ | 4085 | 3.77k | using FMT_STRING_VIEW = \ | 4086 | 3.77k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 3.77k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 3.77k | return FMT_COMPILE_STRING(); \ | 4089 | 3.77k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<long double, std::__1::ratio<10l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<long double, std::__1::ratio<10l, 1l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 3.29k | [] { \ | 4076 | 3.29k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 3.29k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 3.29k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 3.29k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 3.29k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 3.29k | const { \ | 4082 | 3.29k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 3.29k | } \ | 4084 | 3.29k | }; \ | 4085 | 3.29k | using FMT_STRING_VIEW = \ | 4086 | 3.29k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 3.29k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 3.29k | return FMT_COMPILE_STRING(); \ | 4089 | 3.29k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<long double, std::__1::ratio<1000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<long double, std::__1::ratio<1000l, 1l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 2.47k | [] { \ | 4076 | 2.47k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 2.47k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 2.47k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 2.47k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 2.47k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 2.47k | const { \ | 4082 | 2.47k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 2.47k | } \ | 4084 | 2.47k | }; \ | 4085 | 2.47k | using FMT_STRING_VIEW = \ | 4086 | 2.47k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 2.47k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 2.47k | return FMT_COMPILE_STRING(); \ | 4089 | 2.47k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<long double, std::__1::ratio<1000000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<long double, std::__1::ratio<1000000l, 1l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 3.24k | [] { \ | 4076 | 3.24k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 3.24k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 3.24k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 3.24k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 3.24k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 3.24k | const { \ | 4082 | 3.24k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 3.24k | } \ | 4084 | 3.24k | }; \ | 4085 | 3.24k | using FMT_STRING_VIEW = \ | 4086 | 3.24k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 3.24k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 3.24k | return FMT_COMPILE_STRING(); \ | 4089 | 3.24k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<long double, std::__1::ratio<1000000000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<long double, std::__1::ratio<1000000000l, 1l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 4.69k | [] { \ | 4076 | 4.69k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 4.69k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 4.69k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 4.69k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 4.69k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 4.69k | const { \ | 4082 | 4.69k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 4.69k | } \ | 4084 | 4.69k | }; \ | 4085 | 4.69k | using FMT_STRING_VIEW = \ | 4086 | 4.69k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 4.69k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 4.69k | return FMT_COMPILE_STRING(); \ | 4089 | 4.69k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<long double, std::__1::ratio<1000000000000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<long double, std::__1::ratio<1000000000000l, 1l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 3.29k | [] { \ | 4076 | 3.29k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 3.29k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 3.29k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 3.29k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 3.29k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 3.29k | const { \ | 4082 | 3.29k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 3.29k | } \ | 4084 | 3.29k | }; \ | 4085 | 3.29k | using FMT_STRING_VIEW = \ | 4086 | 3.29k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 3.29k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 3.29k | return FMT_COMPILE_STRING(); \ | 4089 | 3.29k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<long double, std::__1::ratio<1000000000000000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<long double, std::__1::ratio<1000000000000000l, 1l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 2.25k | [] { \ | 4076 | 2.25k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 2.25k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 2.25k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 2.25k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 2.25k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 2.25k | const { \ | 4082 | 2.25k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 2.25k | } \ | 4084 | 2.25k | }; \ | 4085 | 2.25k | using FMT_STRING_VIEW = \ | 4086 | 2.25k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 2.25k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 2.25k | return FMT_COMPILE_STRING(); \ | 4089 | 2.25k | }() |
fmt::v11::detail::write_floating_seconds<std::__1::chrono::duration<long double, std::__1::ratio<1000000000000000000l, 1l> > >(fmt::v11::basic_memory_buffer<char, 500ul, fmt::v11::detail::allocator<char> >&, std::__1::chrono::duration<long double, std::__1::ratio<1000000000000000000l, 1l> >, int)::{lambda()#1}::operator()() const Line | Count | Source | 4075 | 2.86k | [] { \ | 4076 | 2.86k | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | 4077 | 2.86k | /* Use a macro-like name to avoid shadowing warnings. */ \ | 4078 | 2.86k | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | 4079 | 2.86k | using char_type = fmt::remove_cvref_t<decltype(s[0])>; \ | 4080 | 2.86k | FMT_CONSTEXPR explicit operator fmt::basic_string_view<char_type>() \ | 4081 | 2.86k | const { \ | 4082 | 2.86k | return fmt::detail::compile_string_to_view<char_type>(s); \ | 4083 | 2.86k | } \ | 4084 | 2.86k | }; \ | 4085 | 2.86k | using FMT_STRING_VIEW = \ | 4086 | 2.86k | fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \ | 4087 | 2.86k | fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \ | 4088 | 2.86k | return FMT_COMPILE_STRING(); \ | 4089 | 2.86k | }() |
|
4090 | | |
4091 | | /** |
4092 | | * Constructs a compile-time format string from a string literal `s`. |
4093 | | * |
4094 | | * **Example**: |
4095 | | * |
4096 | | * // A compile-time error because 'd' is an invalid specifier for strings. |
4097 | | * std::string s = fmt::format(FMT_STRING("{:d}"), "foo"); |
4098 | | */ |
4099 | 150k | #define FMT_STRING(s) FMT_STRING_IMPL(s, fmt::detail::compile_string) |
4100 | | |
4101 | | FMT_API auto vsystem_error(int error_code, string_view fmt, format_args args) |
4102 | | -> std::system_error; |
4103 | | |
4104 | | /** |
4105 | | * Constructs `std::system_error` with a message formatted with |
4106 | | * `fmt::format(fmt, args...)`. |
4107 | | * `error_code` is a system error code as given by `errno`. |
4108 | | * |
4109 | | * **Example**: |
4110 | | * |
4111 | | * // This throws std::system_error with the description |
4112 | | * // cannot open file 'madeup': No such file or directory |
4113 | | * // or similar (system message may vary). |
4114 | | * const char* filename = "madeup"; |
4115 | | * FILE* file = fopen(filename, "r"); |
4116 | | * if (!file) |
4117 | | * throw fmt::system_error(errno, "cannot open file '{}'", filename); |
4118 | | */ |
4119 | | template <typename... T> |
4120 | | auto system_error(int error_code, format_string<T...> fmt, T&&... args) |
4121 | 0 | -> std::system_error { |
4122 | 0 | return vsystem_error(error_code, fmt.str, vargs<T...>{{args...}}); |
4123 | 0 | } |
4124 | | |
4125 | | /** |
4126 | | * Formats an error message for an error returned by an operating system or a |
4127 | | * language runtime, for example a file opening error, and writes it to `out`. |
4128 | | * The format is the same as the one used by `std::system_error(ec, message)` |
4129 | | * where `ec` is `std::error_code(error_code, std::generic_category())`. |
4130 | | * It is implementation-defined but normally looks like: |
4131 | | * |
4132 | | * <message>: <system-message> |
4133 | | * |
4134 | | * where `<message>` is the passed message and `<system-message>` is the system |
4135 | | * message corresponding to the error code. |
4136 | | * `error_code` is a system error code as given by `errno`. |
4137 | | */ |
4138 | | FMT_API void format_system_error(detail::buffer<char>& out, int error_code, |
4139 | | const char* message) noexcept; |
4140 | | |
4141 | | // Reports a system error without throwing an exception. |
4142 | | // Can be used to report errors from destructors. |
4143 | | FMT_API void report_system_error(int error_code, const char* message) noexcept; |
4144 | | |
4145 | | inline auto vformat(detail::locale_ref loc, string_view fmt, format_args args) |
4146 | 0 | -> std::string { |
4147 | 0 | auto buf = memory_buffer(); |
4148 | 0 | detail::vformat_to(buf, fmt, args, loc); |
4149 | 0 | return {buf.data(), buf.size()}; |
4150 | 0 | } |
4151 | | |
4152 | | template <typename... T> |
4153 | | FMT_INLINE auto format(detail::locale_ref loc, format_string<T...> fmt, |
4154 | | T&&... args) -> std::string { |
4155 | | return vformat(loc, fmt.str, vargs<T...>{{args...}}); |
4156 | | } |
4157 | | |
4158 | | template <typename OutputIt, |
4159 | | FMT_ENABLE_IF(detail::is_output_iterator<OutputIt, char>::value)> |
4160 | | auto vformat_to(OutputIt out, detail::locale_ref loc, string_view fmt, |
4161 | | format_args args) -> OutputIt { |
4162 | | auto&& buf = detail::get_buffer<char>(out); |
4163 | | detail::vformat_to(buf, fmt, args, loc); |
4164 | | return detail::get_iterator(buf, out); |
4165 | | } |
4166 | | |
4167 | | template <typename OutputIt, typename... T, |
4168 | | FMT_ENABLE_IF(detail::is_output_iterator<OutputIt, char>::value)> |
4169 | | FMT_INLINE auto format_to(OutputIt out, detail::locale_ref loc, |
4170 | | format_string<T...> fmt, T&&... args) -> OutputIt { |
4171 | | return fmt::vformat_to(out, loc, fmt.str, vargs<T...>{{args...}}); |
4172 | | } |
4173 | | |
4174 | | template <typename... T> |
4175 | | FMT_NODISCARD FMT_INLINE auto formatted_size(detail::locale_ref loc, |
4176 | | format_string<T...> fmt, |
4177 | | T&&... args) -> size_t { |
4178 | | auto buf = detail::counting_buffer<>(); |
4179 | | detail::vformat_to(buf, fmt.str, vargs<T...>{{args...}}, loc); |
4180 | | return buf.count(); |
4181 | | } |
4182 | | |
4183 | | FMT_API auto vformat(string_view fmt, format_args args) -> std::string; |
4184 | | |
4185 | | /** |
4186 | | * Formats `args` according to specifications in `fmt` and returns the result |
4187 | | * as a string. |
4188 | | * |
4189 | | * **Example**: |
4190 | | * |
4191 | | * #include <fmt/format.h> |
4192 | | * std::string message = fmt::format("The answer is {}.", 42); |
4193 | | */ |
4194 | | template <typename... T> |
4195 | | FMT_NODISCARD FMT_INLINE auto format(format_string<T...> fmt, T&&... args) |
4196 | 3.76k | -> std::string { |
4197 | 3.76k | return vformat(fmt.str, vargs<T...>{{args...}}); |
4198 | 3.76k | } |
4199 | | |
4200 | | /** |
4201 | | * Converts `value` to `std::string` using the default format for type `T`. |
4202 | | * |
4203 | | * **Example**: |
4204 | | * |
4205 | | * std::string answer = fmt::to_string(42); |
4206 | | */ |
4207 | | template <typename T, FMT_ENABLE_IF(std::is_integral<T>::value)> |
4208 | | FMT_NODISCARD auto to_string(T value) -> std::string { |
4209 | | // The buffer should be large enough to store the number including the sign |
4210 | | // or "false" for bool. |
4211 | | char buffer[max_of(detail::digits10<T>() + 2, 5)]; |
4212 | | char* begin = buffer; |
4213 | | return {buffer, detail::write<char>(begin, value)}; |
4214 | | } |
4215 | | |
4216 | | template <typename T, FMT_ENABLE_IF(detail::use_format_as<T>::value)> |
4217 | | FMT_NODISCARD auto to_string(const T& value) -> std::string { |
4218 | | return to_string(format_as(value)); |
4219 | | } |
4220 | | |
4221 | | template <typename T, FMT_ENABLE_IF(!std::is_integral<T>::value && |
4222 | | !detail::use_format_as<T>::value)> |
4223 | | FMT_NODISCARD auto to_string(const T& value) -> std::string { |
4224 | | auto buffer = memory_buffer(); |
4225 | | detail::write<char>(appender(buffer), value); |
4226 | | return {buffer.data(), buffer.size()}; |
4227 | | } |
4228 | | |
4229 | | FMT_END_EXPORT |
4230 | | FMT_END_NAMESPACE |
4231 | | |
4232 | | #ifdef FMT_HEADER_ONLY |
4233 | | # define FMT_FUNC inline |
4234 | | # include "format-inl.h" |
4235 | | #endif |
4236 | | |
4237 | | // Restore _LIBCPP_REMOVE_TRANSITIVE_INCLUDES. |
4238 | | #ifdef FMT_REMOVE_TRANSITIVE_INCLUDES |
4239 | | # undef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES |
4240 | | #endif |
4241 | | |
4242 | | #endif // FMT_FORMAT_H_ |