From: Shane Carr Date: Fri, 27 Apr 2018 08:02:40 +0000 (+0000) Subject: ICU-13725 Responding to small code review comments. X-Git-Tag: release-62-rc~187 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d5253cfcae6183358a1ede3b27a750e17adb4ccc;p=icu ICU-13725 Responding to small code review comments. X-SVN-Rev: 41283 --- diff --git a/icu4c/source/i18n/number_decimalquantity.cpp b/icu4c/source/i18n/number_decimalquantity.cpp index dd6f5ca23c6..599d35d2701 100644 --- a/icu4c/source/i18n/number_decimalquantity.cpp +++ b/icu4c/source/i18n/number_decimalquantity.cpp @@ -511,7 +511,7 @@ int64_t DecimalQuantity::toLong(bool truncateIfOverflow) const { result = result * 10 + getDigitPos(magnitude - scale); } if (isNegative()) { - return static_cast(~result + 1); // i.e., -result + return static_cast(0LL - result); // i.e., -result } return static_cast(result); } diff --git a/icu4c/source/i18n/number_utils.cpp b/icu4c/source/i18n/number_utils.cpp index 4db4e4fadc1..4f519e1daa0 100644 --- a/icu4c/source/i18n/number_utils.cpp +++ b/icu4c/source/i18n/number_utils.cpp @@ -1,8 +1,6 @@ // © 2018 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html -#include -#include #include "unicode/utypes.h" #if !UCONFIG_NO_FORMATTING @@ -11,6 +9,8 @@ // Helpful in toString methods and elsewhere. #define UNISTR_FROM_STRING_EXPLICIT +#include +#include #include "number_types.h" #include "number_utils.h" #include "charstr.h"