OSDN Git Service

Optimize printf() field width accumulation function.
authorKeith Marshall <keithmarshall@users.sourceforge.net>
Sun, 24 Jul 2016 15:35:49 +0000 (16:35 +0100)
committerKeith Marshall <keithmarshall@users.sourceforge.net>
Sun, 24 Jul 2016 15:35:49 +0000 (16:35 +0100)
mingwrt/ChangeLog
mingwrt/mingwex/stdio/pformat.c

index 7347834..6378264 100644 (file)
@@ -1,3 +1,11 @@
+2016-07-24  Keith Marshall  <keithmarshall@users.sourceforge.net>
+
+       Optimize printf() field width accumulation function.
+
+       * mingwex/stdio/pformat.c (__imul10plus): Omit multiply by ten on
+       already accumulated zero total; it is unnecessary, since ten times
+       zero is still zero.
+
 2016-07-22  Keith Marshall  <keithmarshall@users.sourceforge.net>
 
        Fix printf() field width parsing regression issue [#2309].
index a40ef02..593e712 100644 (file)
@@ -1758,7 +1758,7 @@ static __pformat_inline__
  * able to override an initial PFORMAT_IGNORE (-1) setting).
  */
 int __pformat_imul10plus( int total, int units )
-{ return units + ((total >= 0) ? ((total + (total << 2)) << 1) : 0); }
+{ return units + ((total > 0) ? ((total + (total << 2)) << 1) : 0); }
 
 static
 int __pformat_read_arg_index( const char **fmt )