diff --git a/include/fmt/format.h b/include/fmt/format.h index 83437f63..1e6f851b 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -1685,7 +1685,8 @@ template FMT_CONSTEXPR FMT_INLINE OutputIt write_int(OutputIt out, int num_digits, string_view prefix, const basic_format_specs& specs, W write_digits) { - if (specs.width == 0 && specs.precision < 0) { + // 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.size()); if (prefix.size() != 0) it = copy_str(prefix.begin(), prefix.end(), it);