aboutsummaryrefslogtreecommitdiff
path: root/src/core/utils/quantization/AsymmHelpers.cpp
diff options
context:
space:
mode:
authorPablo Tello <pablo.tello@arm.com>2022-03-07 18:20:12 +0000
committerPablo Marquez Tello <pablo.tello@arm.com>2022-03-10 13:44:39 +0000
commit4e66d707a292b90a344e32c59eb1dacb67a0e4c1 (patch)
tree48f8548c7a03f3586d27ae7b06d954b958912ee4 /src/core/utils/quantization/AsymmHelpers.cpp
parent17c48f9e518abfcb45477f0eeebf487498c6a270 (diff)
downloadComputeLibrary-4e66d707a292b90a344e32c59eb1dacb67a0e4c1.tar.gz
Added windows native build support
Resolves MLCE-739 Signed-off-by: Pablo Tello <pablo.tello@arm.com> Change-Id: I30a11393e928061c82a5c93d8ec195c04a0e838b Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/7279 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Giorgio Arena <giorgio.arena@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/core/utils/quantization/AsymmHelpers.cpp')
-rw-r--r--src/core/utils/quantization/AsymmHelpers.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/core/utils/quantization/AsymmHelpers.cpp b/src/core/utils/quantization/AsymmHelpers.cpp
index 4ce60996f5..eb008639b1 100644
--- a/src/core/utils/quantization/AsymmHelpers.cpp
+++ b/src/core/utils/quantization/AsymmHelpers.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2021 Arm Limited.
+ * Copyright (c) 2017-2022 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -206,7 +206,9 @@ int32_t saturating_rounding_doubling_highmul(int32_t a, int32_t b)
int64_t a_64(a);
int64_t b_64(b);
int64_t ab_64 = a_64 * b_64;
- bool is_positive_or_zero = a == 0 || b == 0 || (std::signbit(a) == std::signbit(b));
+ const bool is_positive_or_zero =
+ a == 0 || b == 0 ||
+ (std::signbit(static_cast<double>(a)) == std::signbit(static_cast<double>(b)));
int32_t nudge = is_positive_or_zero ? (1 << 30) : (1 - (1 << 30));
int32_t ab_x2_high32 = static_cast<int32_t>((ab_64 + nudge) / (1ll << 31));
return overflow ? std::numeric_limits<int32_t>::max() : ab_x2_high32;