saturated_arithmetic.h file
Defines templated functions for saturated arithmetic. See Pixel data types.
Contents
- Reference
Functions
-
template<typename T, <SFINAE> = 0>auto dip::
saturated_add (T lhs, T rhs) -> T constexpr - Adds two values using saturated arithmetic.
-
template<typename T, <SFINAE> = 0>auto dip::
saturated_sub (T lhs, T rhs) -> T constexpr - Subtracts two values using saturated arithmetic.
-
template<typename T, <SFINAE> = 0>auto dip::
saturated_mul (T lhs, T rhs) -> T constexpr - Multiplies two values using saturated arithmetic.
-
template<typename T, <SFINAE> = 0>auto dip::
saturated_div (T lhs, T rhs) -> T constexpr - Divides two values using saturated arithmetic.
-
template<typename T>auto dip::
saturated_safediv (T lhs, T rhs) -> T constexpr - Divides two values using saturated arithmetic. Tests for division by zero, return 0 rather than infinity or NaN (or an exception).
-
template<typename T, <SFINAE> = 0>auto dip::
saturated_inv (T v) -> T constexpr - Inverts a value using saturated arithmetic. This is the same as negation, but not for unsigned values.