diff options
author | Misha Brukman <brukman+llvm@gmail.com> | 2004-08-17 18:08:52 +0000 |
---|---|---|
committer | Misha Brukman <brukman+llvm@gmail.com> | 2004-08-17 18:08:52 +0000 |
commit | b5e1decefbc294008449f3b414290ab63e713ed5 (patch) | |
tree | 246fb317d85306c0d442b5bc6bd863dcc659c61a | |
parent | 274ba03f49e78ccb5670292a8cab53009dcca896 (diff) | |
download | external_llvm-b5e1decefbc294008449f3b414290ab63e713ed5.zip external_llvm-b5e1decefbc294008449f3b414290ab63e713ed5.tar.gz external_llvm-b5e1decefbc294008449f3b414290ab63e713ed5.tar.bz2 |
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
-rw-r--r-- | include/Support/StringExtras.h | 7 | ||||
-rw-r--r-- | include/llvm/ADT/StringExtras.h | 7 |
2 files changed, 14 insertions, 0 deletions
diff --git a/include/Support/StringExtras.h b/include/Support/StringExtras.h index fdf3227..628528d 100644 --- a/include/Support/StringExtras.h +++ b/include/Support/StringExtras.h @@ -84,6 +84,13 @@ static inline std::string utostr(unsigned X, bool isNeg = false) { 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) { if (X < 0) return utostr(static_cast<unsigned>(-X), true); diff --git a/include/llvm/ADT/StringExtras.h b/include/llvm/ADT/StringExtras.h index fdf3227..628528d 100644 --- a/include/llvm/ADT/StringExtras.h +++ b/include/llvm/ADT/StringExtras.h @@ -84,6 +84,13 @@ static inline std::string utostr(unsigned X, bool isNeg = false) { 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) { if (X < 0) return utostr(static_cast<unsigned>(-X), true); |