aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTatWai Chong <tatwai.chong@arm.com>2024-04-16 13:57:38 -0700
committerEric Kunze <eric.kunze@arm.com>2024-04-17 22:31:05 +0000
commit7a53bb3600c2d2063123382c232e4436a788f175 (patch)
tree4efad8c8e7b62f5bd4bc41554ef659b8ddcf4004
parent862c007ff8637e88ccaac385ae7baab0e7ff5b19 (diff)
downloadreference_model-7a53bb3600c2d2063123382c232e4436a788f175.tar.gz
Fix gcc warning of comparison of different signedness integers
This warning is raised in the integer comparison of `applyClip`. Signed-off-by: TatWai Chong <tatwai.chong@arm.com> Change-Id: If427cb08b8456480898375d8b77302ca7162f737
-rw-r--r--reference_model/src/arith_util.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/reference_model/src/arith_util.h b/reference_model/src/arith_util.h
index fa6d136..d1cdeee 100644
--- a/reference_model/src/arith_util.h
+++ b/reference_model/src/arith_util.h
@@ -353,7 +353,7 @@ T applyClip(T value, U min_val, U max_val)
value = applyMax<T>(value, min_val);
// Handle the numbers of an unsigned type U that becomes unrepresentable when type casting to signed.
- if (std::is_signed_v<T> && std::is_unsigned_v<U> && max_val > std::numeric_limits<T>::max())
+ if (std::is_signed_v<T> && std::is_unsigned_v<U> && max_val > static_cast<U>(std::numeric_limits<T>::max()))
{
max_val = std::numeric_limits<T>::max();
}