diff options
author | Colin Cross <ccross@android.com> | 2022-01-05 17:15:42 -0800 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2022-01-05 17:15:42 -0800 |
commit | 42db4d19acb658d6dcd059a319a378c89c3df75a (patch) | |
tree | b4813503577c8ba3590b19e8d5b8de8e781e2db3 | |
parent | 7415528a1df22d393fbaabb7bcf4df5883d5df3e (diff) | |
download | dng_sdk-42db4d19acb658d6dcd059a319a378c89c3df75a.tar.gz |
Use LONG_MAX instead of __WORDSIZE to find size of longandroid-t-preview-2android-t-preview-1android-t-beta-3android-s-v2-beta-3android-s-qpr3-beta-1android-t-preview-1android-s-v2-beta-3android-s-qpr3-beta-1
__WORDSIZE isn't guaranteed to have any relation to the size of long,
compare LONG_MAX to INT64_MAX to find if int64_t* will be equivalent
to long*.
Bug: 190084016
Test: m USE_HOST_MUSL=true host-native
Change-Id: Ie50e78b92c1c72c9eaedbdc8267b7e382c40e96b
-rw-r--r-- | source/dng_safe_arithmetic.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/source/dng_safe_arithmetic.h b/source/dng_safe_arithmetic.h index b229dc4..66c5ebf 100644 --- a/source/dng_safe_arithmetic.h +++ b/source/dng_safe_arithmetic.h @@ -20,6 +20,7 @@ #ifndef __dng_safe_arithmetic__ #define __dng_safe_arithmetic__ +#include <climits> #include <cstddef> #include <cstdint> #include <limits> @@ -112,7 +113,7 @@ std::int64_t SafeInt64MultSlow(std::int64_t arg1, std::int64_t arg2); #if __has_builtin(__builtin_smull_overflow) inline std::int64_t SafeInt64MultByClang(std::int64_t arg1, std::int64_t arg2) { std::int64_t result; -#if (__WORDSIZE == 64) && !defined(__APPLE__) +#if LONG_MAX == INT64_MAX if (__builtin_smull_overflow(arg1, arg2, &result)) { #else if (__builtin_smulll_overflow(arg1, arg2, &result)) { |