← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~paul-lucas/zorba/pjl-misc into lp:zorba

 

Paul J. Lucas has proposed merging lp:~paul-lucas/zorba/pjl-misc into lp:zorba.

Commit message:
Now calling unicode::is_Nd() only when necessary.

Requested reviews:
  Paul J. Lucas (paul-lucas)

For more details, see:
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/157152

Now calling unicode::is_Nd() only when necessary.
-- 
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/157152
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/runtime/numerics/format_integer.cpp'
--- src/runtime/numerics/format_integer.cpp	2013-04-01 02:22:49 +0000
+++ src/runtime/numerics/format_integer.cpp	2013-04-04 16:16:28 +0000
@@ -237,18 +237,17 @@
           if ( !mandatory_digits && !mandatory_grouping_seps && n_i == n_end )
             break;
           unicode::code_point const pic_cp = *pic_i++;
-          bool const is_mandatory_digit = unicode::is_Nd( pic_cp );
-          if ( pic_cp == '#' || is_mandatory_digit ) {
+          if ( pic_cp == '#' || unicode::is_Nd( pic_cp ) ) {
             u_dest.insert( 0, 1, digit_cp );
             if ( n_i != n_end ) ++n_i;
             ++digit_pos;
+            if ( pic_cp != '#' )
+              --mandatory_digits;
           } else {                      // must be a grouping-separator
             grouping_cp = pic_cp;       // remember for later
             u_dest.insert( 0, 1, grouping_cp );
             --mandatory_grouping_seps;
           }
-          if ( is_mandatory_digit )
-            --mandatory_digits;
         } else {                        // have exhausted the picture
           if ( pic.primary.grouping_interval &&
                digit_pos % pic.primary.grouping_interval == 0 ) {


Follow ups