changeset 2341:253ee03b2455

* src/output/vfnprintf.cxx (vfnprintf): Speed-up formatting of decimal integers by replacing modulo operation with multiply and subtract.
author jlarmour
date Fri, 22 Dec 2006 21:37:00 +0000
parents a47155ebc83f
children 07b0f2be3596
files packages/language/c/libc/stdio/current/ChangeLog packages/language/c/libc/stdio/current/src/output/vfnprintf.cxx
diffstat 2 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/packages/language/c/libc/stdio/current/ChangeLog
+++ b/packages/language/c/libc/stdio/current/ChangeLog
@@ -1,3 +1,9 @@
+2006-12-22  Sergei Organov  <osv@javad.com>
+
+	* src/output/vfnprintf.cxx (vfnprintf): Speed-up formatting of
+	decimal integers by replacing modulo operation with multiply and
+	subtract.
+
 2006-09-27  Jonathan Larmour  <jifl@eCosCentric.com>
 
 	* include/stdio.h: Make fpos_t be signed to allow negative
--- a/packages/language/c/libc/stdio/current/src/output/vfnprintf.cxx
+++ b/packages/language/c/libc/stdio/current/src/output/vfnprintf.cxx
@@ -555,8 +555,9 @@ number:                 if ((dprec = pre
                                 case DEC:
                                         /* many numbers are 1 digit */
                                         while (_uquad >= 10) {
-                                                *--cp = to_char(_uquad % 10);
-                                                _uquad /= 10;
+                                                u_quad_t next = _uquad / 10;
+                                                *--cp = to_char(_uquad - (next * 10));
+                                                _uquad = next;
                                         }
                                         *--cp = to_char(_uquad);
                                         break;