summaryrefslogtreecommitdiff
path: root/include/o3tl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-05-28 21:20:27 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-05-29 00:42:50 +0200
commit98a4aa7ca4c3277e81171a2597dc942e2bfaa2aa (patch)
tree93e4c1592d48540db450d33bbe45e4eaa82fcbc8 /include/o3tl
parent5df5e1bbc68f54dd7bc4b46f0a05a7150d84470a (diff)
coverity#1409892 silence Operands don't affect result
this might work to make this appear deliberate to coverity Change-Id: Iad11e72feb154991b04cfb5960bd06d33c6b96a0 Reviewed-on: https://gerrit.libreoffice.org/38116 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'include/o3tl')
-rw-r--r--include/o3tl/strong_int.hxx14
1 files changed, 9 insertions, 5 deletions
diff --git a/include/o3tl/strong_int.hxx b/include/o3tl/strong_int.hxx
index 8a9d91dbfb8c..738d30f01a8b 100644
--- a/include/o3tl/strong_int.hxx
+++ b/include/o3tl/strong_int.hxx
@@ -36,33 +36,37 @@ template<typename T1, typename T2> constexpr
typename std::enable_if<
std::is_signed<T1>::value && std::is_signed<T2>::value, bool>::type
isInRange(T2 value) {
- return value >= std::numeric_limits<T1>::min()
- && value <= std::numeric_limits<T1>::max();
+ const bool ret = value >= std::numeric_limits<T1>::min()
+ && value <= std::numeric_limits<T1>::max();
+ return ret;
}
template<typename T1, typename T2> constexpr
typename std::enable_if<
std::is_signed<T1>::value && std::is_unsigned<T2>::value, bool>::type
isInRange(T2 value) {
- return value
+ const bool ret = value
<= static_cast<typename std::make_unsigned<T1>::type>(
std::numeric_limits<T1>::max());
+ return ret;
}
template<typename T1, typename T2> constexpr
typename std::enable_if<
std::is_unsigned<T1>::value && std::is_signed<T2>::value, bool>::type
isInRange(T2 value) {
- return value >= 0
+ const bool ret = value >= 0
&& (static_cast<typename std::make_unsigned<T2>::type>(value)
<= std::numeric_limits<T1>::max());
+ return ret;
}
template<typename T1, typename T2> constexpr
typename std::enable_if<
std::is_unsigned<T1>::value && std::is_unsigned<T2>::value, bool>::type
isInRange(T2 value) {
- return value <= std::numeric_limits<T1>::max();
+ const bool ret = value <= std::numeric_limits<T1>::max();
+ return ret;
}
}