raw_ostream: Follow the 32-bit path when printing "small" decimal numbers.
authorDaniel Dunbar <daniel@zuster.org>
Wed, 29 Jul 2009 06:45:14 +0000 (06:45 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Wed, 29 Jul 2009 06:45:14 +0000 (06:45 +0000)
llvm-svn: 77444

llvm/lib/Support/raw_ostream.cpp

index 992c11a..d2d0f4e 100644 (file)
@@ -89,6 +89,10 @@ raw_ostream &raw_ostream::operator<<(long N) {
 }
 
 raw_ostream &raw_ostream::operator<<(unsigned long long N) {
+  // Output using 32-bit div/mod when possible.
+  if (N == static_cast<unsigned long>(N))
+    return this->operator<<(static_cast<unsigned long>(N));
+
   // Zero is a special case.
   if (N == 0)
     return *this << '0';