You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by se...@apache.org on 2009/05/26 19:05:35 UTC

svn commit: r778800 - /stdcxx/branches/4.2.x/src/num_put.cpp

Author: sebor
Date: Tue May 26 17:05:35 2009
New Revision: 778800

URL: http://svn.apache.org/viewvc?rev=778800&view=rev
Log:
2009-05-26  Martin Sebor  <se...@apache.org>

	STDCXX-1036
	* src/num_put.cpp (__rw_dtoa): Called the unsigned overload of __rw_dtoa
	only once to avoid gcc 4.4 -Winline warning (and for a small efficiency
	gain).

Modified:
    stdcxx/branches/4.2.x/src/num_put.cpp

Modified: stdcxx/branches/4.2.x/src/num_put.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/src/num_put.cpp?rev=778800&r1=778799&r2=778800&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/src/num_put.cpp (original)
+++ stdcxx/branches/4.2.x/src/num_put.cpp Tue May 26 17:05:35 2009
@@ -153,7 +153,7 @@
 
     const size_t len = begin - end;
 
-   memmove (buf, end, len);
+    memmove (buf, end, len);
 
     return len;
 }
@@ -185,7 +185,7 @@
 
     const size_t len = begin - end;
 
-   memmove (buf, end, len);
+    memmove (buf, end, len);
 
     return len;
 }
@@ -194,13 +194,23 @@
 static inline size_t
 __rw_dtoa (char *buf, _LLong i, unsigned flags)
 {
+    size_t n;
+
     if (i < 0) {
+        // prepend the minus sign and clear the showpos bit in flags
+        // and the sign bit in the number
         flags  &= ~_RWSTD_IOS_SHOWPOS;
         *buf++  = '-';
-        return 1 + __rw_dtoa (buf, _RWSTD_STATIC_CAST (_ULLong, -i), flags);
+
+        i = -i;
+
+        // remember to add 1 for the minus sign
+        n = 1;
     }
-        
-    return __rw_dtoa (buf, _RWSTD_STATIC_CAST (_ULLong, i), flags);
+    else
+        n = 0;   // no sign here
+
+    return n + __rw_dtoa (buf, _RWSTD_STATIC_CAST (_ULLong, i), flags);
 }
 
 
@@ -314,7 +324,7 @@
 }
 
 
-static  inline size_t
+static inline size_t
 __rw_dtoa (char *buf, unsigned long i, unsigned flags)
 {
     // get the maximum number of decimal digits for an unsigned long
@@ -343,7 +353,7 @@
     // move the contents of the buffer to the beginning
     const size_t len = begin - end;
 
-   memmove (buf, end, len);
+    memmove (buf, end, len);
 
     return len;
 }
@@ -352,14 +362,23 @@
 static inline size_t
 __rw_dtoa (char *buf, long i, unsigned flags)
 {
+    size_t n;
+
     if (i < 0) {
+        // prepend the minus sign and clear the showpos bit in flags
+        // and the sign bit in the number
         flags  &= ~_RWSTD_IOS_SHOWPOS;
         *buf++  = '-';
-        return 1 + __rw_dtoa (buf, _RWSTD_STATIC_CAST (unsigned long, -i),
-                              flags);
+
+        i = -i;
+
+        // remember to add 1 for the minus sign
+        n = 1;
     }
-        
-    return __rw_dtoa (buf, _RWSTD_STATIC_CAST (unsigned long, i), flags);
+    else
+        n = 0;   // no sign here
+
+    return n + __rw_dtoa (buf, _RWSTD_STATIC_CAST (unsigned long, i), flags);
 }