Commit 76389e05 authored by gabime's avatar gabime

Optimize fmt_helper::pad3()

parent 0a14e491
......@@ -73,9 +73,21 @@ inline void pad_uint(T n, unsigned int width, memory_buf_t &dest)
template<typename T>
inline void pad3(T n, memory_buf_t &dest)
{
pad_uint(n, 3, dest);
if(n < 1000)
{
dest.push_back(n / 100 + '0');
n = n % 100;
dest.push_back((n / 10) + '0');
dest.push_back((n % 10) + '0');
}
else
{
append_int(n, dest);
}
}
template<typename T>
inline void pad6(T n, memory_buf_t &dest)
{
......
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