[llvm-commits] [llvm] r79450 - /llvm/trunk/include/llvm/ADT/SmallString.h

Daniel Dunbar daniel at zuster.org
Wed Aug 19 12:28:18 PDT 2009


Author: ddunbar
Date: Wed Aug 19 14:28:18 2009
New Revision: 79450

URL: http://llvm.org/viewvc/llvm-project?rev=79450&view=rev
Log:
Remove SmallString::append_*int* methods; how many copies of int -> str
conversion code do we really need?
 - S.append_uint(N) can be replaced with 'raw_svector_ostream(S) << N' which is
   somewhat slower due to the extra set up cost, but still plenty fast
   (especially if the svector set up cost can be amortized).

Modified:
    llvm/trunk/include/llvm/ADT/SmallString.h

Modified: llvm/trunk/include/llvm/ADT/SmallString.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SmallString.h?rev=79450&r1=79449&r2=79450&view=diff

==============================================================================
--- llvm/trunk/include/llvm/ADT/SmallString.h (original)
+++ llvm/trunk/include/llvm/ADT/SmallString.h Wed Aug 19 14:28:18 2009
@@ -59,47 +59,6 @@
     this->push_back(C);
     return *this;
   }
-
-  SmallString &append_uint_32(uint32_t N) {
-    char Buffer[20];
-    char *BufPtr = Buffer+20;
-
-    if (N == 0) *--BufPtr = '0';  // Handle special case.
-
-    while (N) {
-      *--BufPtr = '0' + char(N % 10);
-      N /= 10;
-    }
-    this->append(BufPtr, Buffer+20);
-    return *this;
-  }
-
-  SmallString &append_uint(uint64_t N) {
-    if (N == uint32_t(N))
-      return append_uint_32(uint32_t(N));
-
-    char Buffer[40];
-    char *BufPtr = Buffer+40;
-
-    if (N == 0) *--BufPtr = '0';  // Handle special case...
-
-    while (N) {
-      *--BufPtr = '0' + char(N % 10);
-      N /= 10;
-    }
-
-    this->append(BufPtr, Buffer+40);
-    return *this;
-  }
-
-  SmallString &append_sint(int64_t N) {
-    if (N < 0) {
-      this->push_back('-');
-      N = -N;
-    }
-    return append_uint((uint64_t)N);
-  }
-
 };
 
 





More information about the llvm-commits mailing list