Skip to content

Commit

Permalink
Workaround missed optimization opportunity
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut committed Mar 12, 2021
1 parent eef4ba9 commit cdf877d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion include/fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -1685,7 +1685,8 @@ template <typename OutputIt, typename Char, typename W>
FMT_CONSTEXPR FMT_INLINE OutputIt
write_int(OutputIt out, int num_digits, string_view prefix,
const basic_format_specs<Char>& 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<Char>(prefix.begin(), prefix.end(), it);
Expand Down

0 comments on commit cdf877d

Please sign in to comment.