diff options
Diffstat (limited to 'include/o3tl/safeint.hxx')
-rw-r--r-- | include/o3tl/safeint.hxx | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/o3tl/safeint.hxx b/include/o3tl/safeint.hxx index fa08b6dfc899..b65b93e0a541 100644 --- a/include/o3tl/safeint.hxx +++ b/include/o3tl/safeint.hxx @@ -12,6 +12,7 @@ #include <sal/config.h> +#include <cassert> #include <limits> #include <type_traits> @@ -226,6 +227,13 @@ template<typename T> inline typename std::enable_if<std::is_unsigned<T>::value, #endif +template<typename T> constexpr std::enable_if_t<std::is_signed_v<T>, std::make_unsigned_t<T>> +make_unsigned(T value) +{ + assert(value >= 0); + return value; +} + } #endif |