Apply clang-format

This commit is contained in:
Victor Zverovich 2023-09-22 09:07:43 -07:00
parent 7529af8f99
commit 649f2460db

View File

@ -1740,7 +1740,6 @@ FMT_CONSTEXPR inline fp operator*(fp x, fp y) {
return {multiply(x.f, y.f), x.e + y.e + 64}; return {multiply(x.f, y.f), x.e + y.e + 64};
} }
template <typename T, bool doublish = num_bits<T>() == num_bits<double>()> template <typename T, bool doublish = num_bits<T>() == num_bits<double>()>
using convert_float_result = using convert_float_result =
conditional_t<std::is_same<T, float>::value || doublish, double, T>; conditional_t<std::is_same<T, float>::value || doublish, double, T>;
@ -3160,8 +3159,10 @@ FMT_CONSTEXPR20 inline void format_dragon(basic_fp<uint128_t> value,
} }
if (buf[0] == overflow) { if (buf[0] == overflow) {
buf[0] = '1'; buf[0] = '1';
if ((flags & dragon::fixed) != 0) buf.push_back('0'); if ((flags & dragon::fixed) != 0)
else ++exp10; buf.push_back('0');
else
++exp10;
} }
return; return;
} }
@ -3278,7 +3279,6 @@ FMT_CONSTEXPR inline uint32_t fractional_part_rounding_thresholds(int index) {
template <typename Float> template <typename Float>
FMT_CONSTEXPR20 auto format_float(Float value, int precision, float_specs specs, FMT_CONSTEXPR20 auto format_float(Float value, int precision, float_specs specs,
buffer<char>& buf) -> int { buffer<char>& buf) -> int {
// float is passed as double to reduce the number of instantiations. // float is passed as double to reduce the number of instantiations.
static_assert(!std::is_same<Float, float>::value, ""); static_assert(!std::is_same<Float, float>::value, "");
FMT_ASSERT(value >= 0, "value is negative"); FMT_ASSERT(value >= 0, "value is negative");
@ -3480,12 +3480,12 @@ FMT_CONSTEXPR20 auto format_float(Float value, int precision, float_specs specs,
// fractional part is strictly larger than 1/2. // fractional part is strictly larger than 1/2.
if (precision < 9) { if (precision < 9) {
uint32_t fractional_part = static_cast<uint32_t>(prod); uint32_t fractional_part = static_cast<uint32_t>(prod);
should_round_up = fractional_part >= should_round_up =
fractional_part_rounding_thresholds fractional_part >= fractional_part_rounding_thresholds(
(8 - number_of_digits_to_print) || 8 - number_of_digits_to_print) ||
((fractional_part >> 31) & ((fractional_part >> 31) &
((digits & 1) | (second_third_subsegments != 0) | ((digits & 1) | (second_third_subsegments != 0) |
has_more_segments)) != 0; has_more_segments)) != 0;
} }
// Rounding at the subsegment boundary. // Rounding at the subsegment boundary.
// In this case, the fractional part is at least 1/2 if and only if // In this case, the fractional part is at least 1/2 if and only if
@ -3520,12 +3520,12 @@ FMT_CONSTEXPR20 auto format_float(Float value, int precision, float_specs specs,
// of 19 digits, so in this case the third segment should be // of 19 digits, so in this case the third segment should be
// consisting of a genuine digit from the input. // consisting of a genuine digit from the input.
uint32_t fractional_part = static_cast<uint32_t>(prod); uint32_t fractional_part = static_cast<uint32_t>(prod);
should_round_up = fractional_part >= should_round_up =
fractional_part_rounding_thresholds fractional_part >= fractional_part_rounding_thresholds(
(8 - number_of_digits_to_print) || 8 - number_of_digits_to_print) ||
((fractional_part >> 31) & ((fractional_part >> 31) &
((digits & 1) | (third_subsegment != 0) | ((digits & 1) | (third_subsegment != 0) |
has_more_segments)) != 0; has_more_segments)) != 0;
} }
// Rounding at the subsegment boundary. // Rounding at the subsegment boundary.
else { else {
@ -4198,14 +4198,12 @@ template <typename T> struct formatter<group_digits_view<T>> : formatter<T> {
} }
}; };
template <typename T> template <typename T> struct nested_view {
struct nested_view {
const formatter<T>* fmt; const formatter<T>* fmt;
const T* value; const T* value;
}; };
template <typename T> template <typename T> struct formatter<nested_view<T>> {
struct formatter<nested_view<T>> {
FMT_CONSTEXPR auto parse(format_parse_context& ctx) -> const char* { FMT_CONSTEXPR auto parse(format_parse_context& ctx) -> const char* {
return ctx.begin(); return ctx.begin();
} }
@ -4215,8 +4213,7 @@ struct formatter<nested_view<T>> {
} }
}; };
template <typename T> template <typename T> struct nested_formatter {
struct nested_formatter {
private: private:
int width_; int width_;
detail::fill_t<char> fill_; detail::fill_t<char> fill_;
@ -4226,8 +4223,8 @@ struct nested_formatter {
public: public:
FMT_CONSTEXPR auto parse(format_parse_context& ctx) -> const char* { FMT_CONSTEXPR auto parse(format_parse_context& ctx) -> const char* {
auto specs = detail::dynamic_format_specs<char>(); auto specs = detail::dynamic_format_specs<char>();
auto it = parse_format_specs( auto it = parse_format_specs(ctx.begin(), ctx.end(), specs, ctx,
ctx.begin(), ctx.end(), specs, ctx, detail::type::none_type); detail::type::none_type);
width_ = specs.width; width_ = specs.width;
fill_ = specs.fill; fill_ = specs.fill;
align_ = specs.align; align_ = specs.align;