]> granicus.if.org Git - icu/commitdiff
ICU-10273 PluralRules FixedDecimal, avoid undefined cast from NaN to int64_t
authorAndy Heninger <andy.heninger@gmail.com>
Thu, 12 Sep 2013 20:07:53 +0000 (20:07 +0000)
committerAndy Heninger <andy.heninger@gmail.com>
Thu, 12 Sep 2013 20:07:53 +0000 (20:07 +0000)
X-SVN-Rev: 34287

icu4c/source/i18n/plurrule.cpp

index b3274f11eaf3720cf99c877526b9c5e66c0271fa..960bcd2b6aa4f79867b4f957dd37c24659eed7a7 100644 (file)
@@ -1388,11 +1388,15 @@ void FixedDecimal::init(double n, int32_t v, int64_t f) {
     if (isNanOrInfinity) {
         v = 0;
         f = 0;
+        intValue = 0;
+        hasIntegerValue = FALSE;
+    } else {
+        intValue = (int64_t)source;
+        hasIntegerValue = (source == intValue);
     }
+
     visibleDecimalDigitCount = v;
     decimalDigits = f;
-    intValue = (int64_t)source;
-    hasIntegerValue = (source == intValue);
     if (f == 0) {
          decimalDigitsWithoutTrailingZeros = 0;
     } else {