Remove unnecessary cast

This commit is contained in:
Victor Zverovich 2021-09-06 21:14:11 -07:00
parent c771ba361c
commit aeee70a815

View File

@ -1551,8 +1551,7 @@ FMT_CONSTEXPR FMT_INLINE auto write_int(OutputIt out, write_int_arg<T> arg,
static_assert(std::is_same<T, uint32_or_64_or_128_t<T>>::value, ""); static_assert(std::is_same<T, uint32_or_64_or_128_t<T>>::value, "");
auto abs_value = arg.abs_value; auto abs_value = arg.abs_value;
auto prefix = arg.prefix; auto prefix = arg.prefix;
auto pres_type = static_cast<presentation_type>(specs.type); switch (specs.type) {
switch (pres_type) {
case presentation_type::none: case presentation_type::none:
case presentation_type::dec: { case presentation_type::dec: {
if (specs.localized && if (specs.localized &&
@ -1568,7 +1567,7 @@ FMT_CONSTEXPR FMT_INLINE auto write_int(OutputIt out, write_int_arg<T> arg,
} }
case presentation_type::hex_lower: case presentation_type::hex_lower:
case presentation_type::hex_upper: { case presentation_type::hex_upper: {
bool upper = pres_type == presentation_type::hex_upper; bool upper = specs.type == presentation_type::hex_upper;
if (specs.alt) if (specs.alt)
prefix_append(prefix, unsigned(upper ? 'X' : 'x') << 8 | '0'); prefix_append(prefix, unsigned(upper ? 'X' : 'x') << 8 | '0');
int num_digits = count_digits<4>(abs_value); int num_digits = count_digits<4>(abs_value);
@ -1579,7 +1578,7 @@ FMT_CONSTEXPR FMT_INLINE auto write_int(OutputIt out, write_int_arg<T> arg,
} }
case presentation_type::bin_lower: case presentation_type::bin_lower:
case presentation_type::bin_upper: { case presentation_type::bin_upper: {
bool upper = pres_type == presentation_type::bin_upper; bool upper = specs.type == presentation_type::bin_upper;
if (specs.alt) if (specs.alt)
prefix_append(prefix, unsigned(upper ? 'B' : 'b') << 8 | '0'); prefix_append(prefix, unsigned(upper ? 'B' : 'b') << 8 | '0');
int num_digits = count_digits<1>(abs_value); int num_digits = count_digits<1>(abs_value);