From 61bed2fe76aadd4f5a355162817c9e85aa745332 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 4 Jan 2005 01:56:28 +0000 Subject: [PATCH] Do not let 'ftostr' return a string that starts with spaces. This allows the AsmWriter to emit FP constants like 1.0 in normal exponential notation instead of hex notation. llvm-svn: 19279 --- include/llvm/ADT/StringExtras.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/llvm/ADT/StringExtras.h b/include/llvm/ADT/StringExtras.h index 7e25f654d8f..e6d1feac1ab 100644 --- a/include/llvm/ADT/StringExtras.h +++ b/include/llvm/ADT/StringExtras.h @@ -100,7 +100,9 @@ static inline std::string itostr(int X) { static inline std::string ftostr(double V) { char Buffer[200]; sprintf(Buffer, "%20.6e", V); - return Buffer; + char *B = Buffer; + while (*B == ' ') ++B; + return B; } static inline std::string LowercaseString(const std::string &S) {