Commit 7766bc25 authored by gabime's avatar gabime

Updated fmt_helper::pad2()

parent 34244656
......@@ -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<char>('0' + n / 10));
dest.push_back(static_cast<char>('0' + n % 10));
}
else if (n >= 0) // 0-9
{
dest.push_back('0');
dest.push_back(static_cast<char>('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);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment