From c4b9ccb45a9f9a47e252d1ce4b5d55211a22a389 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Sat, 13 Jul 2019 20:25:21 +0900 Subject: libcamera: utils: Add clamp() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit C++11 does not support std::clamp(), add a custom implementation in utils. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- src/libcamera/utils.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/libcamera/utils.cpp') diff --git a/src/libcamera/utils.cpp b/src/libcamera/utils.cpp index ef365366..afbdd834 100644 --- a/src/libcamera/utils.cpp +++ b/src/libcamera/utils.cpp @@ -85,6 +85,14 @@ char *secure_getenv(const char *name) * \return The number of elements in the intersection of the two ranges */ +/** + * \fn libcamera::utils::clamp(const T& v, const T& lo, const T& hi) + * \param[in] v The value to clamp + * \param[in] lo The lower boundary to clamp v to + * \param[in] hi The higher boundary to clamp v to + * \return lo if v is less than lo, hi if v is greater than hi, otherwise v + */ + } /* namespace utils */ } /* namespace libcamera */ -- cgit v1.2.1