diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2023-10-04 15:13:53 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2023-10-05 13:58:12 +0200 |
commit | d205274a014acabbed88b18d5058682a0ca46f9c (patch) | |
tree | 826c236b1104d262122f74d0277e0fff206ed273 /include/tools/helpers.hxx | |
parent | 3c162a7a312022716e0648f95662b33577b5993d (diff) |
Drop MinMax in favor of std::clamp
Change-Id: I021f524b232ddbe091981444d859d35dd9cd05ac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157582
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'include/tools/helpers.hxx')
-rw-r--r-- | include/tools/helpers.hxx | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/include/tools/helpers.hxx b/include/tools/helpers.hxx index 5f61ba80836c..05ee59960f50 100644 --- a/include/tools/helpers.hxx +++ b/include/tools/helpers.hxx @@ -15,53 +15,6 @@ #include <limits> #include <type_traits> -template<typename T> -inline -typename std::enable_if< - std::is_signed<T>::value || std::is_floating_point<T>::value, long >::type -MinMax(T nVal, tools::Long nMin, tools::Long nMax) -{ - assert(nMin <= nMax); - if (nVal >= nMin) - { - if (nVal <= nMax) - return static_cast<tools::Long>(nVal); - else - return nMax; - } - else - { - return nMin; - } -} - -template<typename T> -inline -typename std::enable_if< - std::is_unsigned<T>::value, long >::type -MinMax(T nVal, tools::Long nMin, tools::Long nMax) -{ - assert(nMin <= nMax); - if (nMax < 0) - { - return nMax; - } - else - { - if (nMin < 0 || nVal >= static_cast<unsigned long>(nMin)) - { - if (nVal <= static_cast<unsigned long>(nMax)) - return static_cast<tools::Long>(nVal); - else - return nMax; - } - else - { - return nMin; - } - } -} - inline sal_uInt32 AlignedWidth4Bytes(sal_uInt32 nWidthBits) { if (nWidthBits > SAL_MAX_UINT32 - 31) |