]> granicus.if.org Git - icu/commitdiff
ICU-13177 Merging trunk to branch
authorShane Carr <shane@unicode.org>
Fri, 23 Jun 2017 00:08:34 +0000 (00:08 +0000)
committerShane Carr <shane@unicode.org>
Fri, 23 Jun 2017 00:08:34 +0000 (00:08 +0000)
X-SVN-Rev: 40195

1  2 
icu4c/source/i18n/nfrs.cpp
icu4j/main/classes/core/src/com/ibm/icu/impl/number/Parse.java
icu4j/main/classes/core/src/com/ibm/icu/text/DecimalFormat.java
icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/NumberFormatTest.java

index ea4a05d749d1c4841c4fb6dac0e0896995183fc2,74ce27a401a069f0c7d9339d407d1d0fd1b6ef2f..6438089c9d7f36905988999d5dab19e62e69d0d3
@@@ -835,20 -834,13 +835,20 @@@ uint64_t util64_pow(uint32_t base, uint
      if (base == 0) {
          return 0;
      }
-     int64_t result = 1;
-     int64_t pow = base;
+     uint64_t result = 1;
+     uint64_t pow = base;
 -    while (exponent > 0) { 
 -        if ((exponent & 1) == 1) { 
 +    UBool safe = TRUE;
 +    while (exponent > 0) {
 +        U_ASSERT(safe);
 +        if ((exponent & 1) == 1) {
              result *= pow; 
          } 
 -        pow *= pow; 
 +        if (pow >= 0x100000000L) {
 +            // The next step will push us out of bounds
 +            safe = FALSE;
 +        } else {
 +            pow *= pow;
 +        }
          exponent >>= 1; 
      } 
      return result;