Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2774

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/74/2774/1

Reuse ImplPower10()

Change-Id: I0a86e43065689d2478ced4804ab083244d8d35f5
---
M vcl/source/control/field.cxx
1 file changed, 5 insertions(+), 19 deletions(-)



diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index c0037e9..69cb02e 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -53,7 +53,7 @@
 
 static sal_Int64 ImplPower10( sal_uInt16 n )
 {
-    sal_uInt16 i;
+    sal_uInt16  i;
     sal_Int64   nValue = 1;
 
     for ( i=0; i < n; i++ )
@@ -1264,9 +1264,7 @@
         {
             if ( (mnBaseValue <= 0) || (nValue <= 0) )
                 return nValue;
-            nDiv = 100;
-            for ( sal_uInt16 i=0; i < nDecDigits; i++ )
-                nDiv *= 10;
+            nDiv = 100 * ImplPower10(nDecDigits);
 
             nMult = mnBaseValue;
         }
@@ -1333,11 +1331,7 @@
     }
     else
     {
-        while ( nDecDigits )
-        {
-            nValue *= 10;
-            nDecDigits--;
-        }
+        nValue *= ImplPower10(nDecDigits);
     }
 
     if ( eFieldUnit != eOutUnit )
@@ -1381,19 +1375,11 @@
 
     if ( nDecDigits < 0 )
     {
-        while ( nDecDigits )
-        {
-            nValue *= 10;
-            nDecDigits++;
-        }
+        nValue *= ImplPower10(-nDecDigits);
     }
     else
     {
-        while ( nDecDigits )
-        {
-            nValue /= 10;
-            nDecDigits--;
-        }
+        nValue /= ImplPower10(nDecDigits);
     }
 
     if ( eFieldUnit != eInUnit )

-- 
To view, visit https://gerrit.libreoffice.org/2774
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0a86e43065689d2478ced4804ab083244d8d35f5
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Christina Roßmanith <ChrRossmanith@web.de>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.