diff options
author | Vidhya Sudhan Loganathan <vidhyasudhan.loganathan@arm.com> | 2018-12-18 14:17:00 +0000 |
---|---|---|
committer | Georgios Pinitas <georgios.pinitas@arm.com> | 2018-12-18 17:40:19 +0000 |
commit | 5e96be7707a571b136dc64256af399dbbb0fdfe0 (patch) | |
tree | 92229d9824f3089814ed2af56c5f76a474366954 /arm_compute/core/utils/misc/Utility.h | |
parent | 52ebf4219385efe54463dc794ba806b82a6137b3 (diff) | |
download | ComputeLibrary-5e96be7707a571b136dc64256af399dbbb0fdfe0.tar.gz |
COMPMID-1722 : CL: Implement Range
Change-Id: I88da6eb5289c303b1dc91606c1560ce629746058
Reviewed-on: https://review.mlplatform.org/381
Reviewed-by: Gian Marco Iodice <gianmarco.iodice@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Diffstat (limited to 'arm_compute/core/utils/misc/Utility.h')
-rw-r--r-- | arm_compute/core/utils/misc/Utility.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/arm_compute/core/utils/misc/Utility.h b/arm_compute/core/utils/misc/Utility.h index 37c8b66e06..8dd9afd5cd 100644 --- a/arm_compute/core/utils/misc/Utility.h +++ b/arm_compute/core/utils/misc/Utility.h @@ -80,8 +80,10 @@ std::array<typename std::iterator_traits<Iterator>::value_type, N> make_array(It * * @return Clamped value. */ -template <typename T> -inline T clamp(const T &n, const T &lower, const T &upper) +template <typename DataType, typename RangeType = DataType> +inline DataType clamp(const DataType &n, + const DataType &lower = std::numeric_limits<RangeType>::lowest(), + const DataType &upper = std::numeric_limits<RangeType>::max()) { return std::max(lower, std::min(n, upper)); } |