diff --git a/include/spdlog/details/fmt_helper.h b/include/spdlog/details/fmt_helper.h index f5a8bad5..06ec373c 100644 --- a/include/spdlog/details/fmt_helper.h +++ b/include/spdlog/details/fmt_helper.h @@ -39,21 +39,12 @@ inline unsigned int count_digits(T n) inline void pad2(int n, memory_buf_t &dest) { - if (n > 99) - { - append_int(n, dest); - } - else if (n > 9) // 10-99 + if (n >= 0 && n < 100) // 0-99 { dest.push_back(static_cast('0' + n / 10)); dest.push_back(static_cast('0' + n % 10)); } - else if (n >= 0) // 0-9 - { - dest.push_back('0'); - dest.push_back(static_cast('0' + n)); - } - else // negatives (unlikely, but just in case, let fmt deal with it) + else // unlikely, but just in case, let fmt deal with it { fmt::format_to(dest, "{:02}", n); }