Fix FormatInt.

This commit is contained in:
Victor Zverovich 2013-09-10 09:28:04 -07:00
parent 2951f8b3d8
commit eded10cf31
2 changed files with 2 additions and 1 deletions

View File

@ -1140,7 +1140,7 @@ class FormatInt {
public: public:
explicit FormatInt(int value) { explicit FormatInt(int value) {
uint64_t abs_value = value; unsigned abs_value = value;
bool negative = value < 0; bool negative = value < 0;
if (negative) if (negative)
abs_value = 0 - value; abs_value = 0 - value;

View File

@ -1287,6 +1287,7 @@ TEST(FormatterTest, Examples) {
TEST(FormatIntTest, FormatInt) { TEST(FormatIntTest, FormatInt) {
EXPECT_EQ("42", fmt::FormatInt(42).str()); EXPECT_EQ("42", fmt::FormatInt(42).str());
EXPECT_EQ("-42", fmt::FormatInt(-42).str());
} }
template <typename T> template <typename T>