diff options
author | Steven R. Loomis <srloomis@us.ibm.com> | 2018-07-09 13:46:16 -0700 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2018-07-11 00:15:23 +0200 |
commit | 538acead6670d711ddb71c0b852089b792c996e3 (patch) | |
tree | 917c6df14436e66d4883feb7bb9269480fce06ab /deps/icu-small/source/common/putil.cpp | |
parent | ed715ef8900afa5056ebd5ef995e89eebd4987c2 (diff) | |
download | android-node-v8-538acead6670d711ddb71c0b852089b792c996e3.tar.gz android-node-v8-538acead6670d711ddb71c0b852089b792c996e3.tar.bz2 android-node-v8-538acead6670d711ddb71c0b852089b792c996e3.zip |
deps: icu 62.1 bump (Unicode 11, CLDR 33.1)
- Full release notes: http://site.icu-project.org/download/62
Fixes: https://github.com/nodejs/node/issues/21452
PR-URL: https://github.com/nodejs/node/pull/21728
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Diffstat (limited to 'deps/icu-small/source/common/putil.cpp')
-rw-r--r-- | deps/icu-small/source/common/putil.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/deps/icu-small/source/common/putil.cpp b/deps/icu-small/source/common/putil.cpp index e367fa6d30..a1e16a9cd9 100644 --- a/deps/icu-small/source/common/putil.cpp +++ b/deps/icu-small/source/common/putil.cpp @@ -533,6 +533,28 @@ uprv_fmin(double x, double y) return (x > y ? y : x); } +U_CAPI UBool U_EXPORT2 +uprv_add32_overflow(int32_t a, int32_t b, int32_t* res) { + // NOTE: Some compilers (GCC, Clang) have primitives available, like __builtin_add_overflow. + // This function could be optimized by calling one of those primitives. + auto a64 = static_cast<int64_t>(a); + auto b64 = static_cast<int64_t>(b); + int64_t res64 = a64 + b64; + *res = static_cast<int32_t>(res64); + return res64 != *res; +} + +U_CAPI UBool U_EXPORT2 +uprv_mul32_overflow(int32_t a, int32_t b, int32_t* res) { + // NOTE: Some compilers (GCC, Clang) have primitives available, like __builtin_mul_overflow. + // This function could be optimized by calling one of those primitives. + auto a64 = static_cast<int64_t>(a); + auto b64 = static_cast<int64_t>(b); + int64_t res64 = a64 * b64; + *res = static_cast<int32_t>(res64); + return res64 != *res; +} + /** * Truncates the given double. * trunc(3.3) = 3.0, trunc (-3.3) = -3.0 |