From 7766bc25d116e5d14de1e95dfb548f6e2e0c3680 Mon Sep 17 00:00:00 2001 From: gabime Date: Sun, 12 Apr 2020 01:40:22 +0300 Subject: [PATCH] Updated fmt_helper::pad2() --- include/spdlog/details/fmt_helper.h | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) 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); }