Add itostr(long) for our furry 64-bit friends.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15885 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Misha Brukman 2004-08-17 18:08:52 +00:00
parent 274ba03f49
commit b5e1decefb
2 changed files with 14 additions and 0 deletions

View File

@ -84,6 +84,13 @@ static inline std::string utostr(unsigned X, bool isNeg = false) {
return std::string(BufPtr); return std::string(BufPtr);
} }
static inline std::string itostr(long X) {
if (X < 0)
return utostr(static_cast<uint64_t>(-X), true);
else
return utostr(static_cast<uint64_t>(X));
}
static inline std::string itostr(int X) { static inline std::string itostr(int X) {
if (X < 0) if (X < 0)
return utostr(static_cast<unsigned>(-X), true); return utostr(static_cast<unsigned>(-X), true);

View File

@ -84,6 +84,13 @@ static inline std::string utostr(unsigned X, bool isNeg = false) {
return std::string(BufPtr); return std::string(BufPtr);
} }
static inline std::string itostr(long X) {
if (X < 0)
return utostr(static_cast<uint64_t>(-X), true);
else
return utostr(static_cast<uint64_t>(X));
}
static inline std::string itostr(int X) { static inline std::string itostr(int X) {
if (X < 0) if (X < 0)
return utostr(static_cast<unsigned>(-X), true); return utostr(static_cast<unsigned>(-X), true);