]> granicus.if.org Git - icu/commitdiff
ICU-13725 Responding to small code review comments.
authorShane Carr <shane@unicode.org>
Fri, 27 Apr 2018 08:02:40 +0000 (08:02 +0000)
committerShane Carr <shane@unicode.org>
Fri, 27 Apr 2018 08:02:40 +0000 (08:02 +0000)
X-SVN-Rev: 41283

icu4c/source/i18n/number_decimalquantity.cpp
icu4c/source/i18n/number_utils.cpp

index dd6f5ca23c6f0bde82f10d40b54205970c5dc8c6..599d35d27018d4457b768ebc586ed5d326449437 100644 (file)
@@ -511,7 +511,7 @@ int64_t DecimalQuantity::toLong(bool truncateIfOverflow) const {
         result = result * 10 + getDigitPos(magnitude - scale);
     }
     if (isNegative()) {
-        return static_cast<int64_t>(~result + 1); // i.e., -result
+        return static_cast<int64_t>(0LL - result); // i.e., -result
     }
     return static_cast<int64_t>(result);
 }
index 4db4e4fadc14751160b6ac0cf7c466d3ba21e29a..4f519e1daa0619ee38585d1be290fb082a64614f 100644 (file)
@@ -1,8 +1,6 @@
 // © 2018 and later: Unicode, Inc. and others.
 // License & terms of use: http://www.unicode.org/copyright.html
 
-#include <stdlib.h>
-#include <cmath>
 #include "unicode/utypes.h"
 
 #if !UCONFIG_NO_FORMATTING
@@ -11,6 +9,8 @@
 // Helpful in toString methods and elsewhere.
 #define UNISTR_FROM_STRING_EXPLICIT
 
+#include <stdlib.h>
+#include <cmath>
 #include "number_types.h"
 #include "number_utils.h"
 #include "charstr.h"