14 #ifndef ECVL_TYPE_PROMOTION_H_    15 #define ECVL_TYPE_PROMOTION_H_    18 #include <type_traits>    24 template<
typename T, 
typename U>
    26     static_assert(std::is_arithmetic<T>::value, 
"T must be arithmetic");
    27     static_assert(std::is_arithmetic<U>::value, 
"U must be arithmetic");
    28     using type = 
typename std::conditional_t<(std::numeric_limits<T>::digits < std::numeric_limits<U>::digits), U, T>;
    31 template<
typename T, 
typename U>
    35 template<
typename T, 
typename U>
    39         std::conditional_t<std::is_floating_point<T>::value, T,
    40         std::conditional_t<std::is_floating_point<U>::value, U,
    44 template<
typename T, 
typename U>
    48 template<
typename T, 
typename U>
    53         std::conditional_t<(
sizeof(T) == 8u || 
sizeof(U) == 8u), 
double,
    54         std::conditional_t<std::is_floating_point<superior_type>::value, 
superior_type,
    55         std::conditional_t<(std::numeric_limits<superior_type>::digits < std::numeric_limits<std::int16_t>::digits), std::int16_t,
    56         std::conditional_t<(std::numeric_limits<superior_type>::digits < std::numeric_limits<std::int32_t>::digits), std::int32_t,
    57         std::conditional_t<(std::numeric_limits<superior_type>::digits < std::numeric_limits<std::int64_t>::digits), std::int64_t, 
double>>>>>;
    60 template<
typename T, 
typename U>
    63 template<DataType DT, DataType DU>
    66 #define PROMOTE_OPERATION(op_name, op_symbol)                               \    67 template<typename T, typename U>                                            \    68 promote_superior_type_t<T, U> Promote ## op_name(T lhs, U rhs) {            \    69     using dsttype = promote_superior_type_t<T, U>;                          \    70     return static_cast<dsttype>(lhs) op_symbol static_cast<dsttype>(rhs);   \    80 #endif // ECVL_TYPE_PROMOTION_H_ 
void Mul(const Image &src1, const Image &src2, Image &dst, DataType dst_type=DataType::none, bool saturate=true)
typename promote_superior_type< T, U >::type promote_superior_type_t
typename std::conditional_t< std::is_floating_point< T >::value &&std::is_floating_point< U >::value, larger_arithmetic_type_t< T, U >, std::conditional_t< std::is_floating_point< T >::value, T, std::conditional_t< std::is_floating_point< U >::value, U, larger_arithmetic_type_t< T, U > >> > type
void Add(const Image &src1, const Image &src2, Image &dst, DataType dst_type=DataType::none, bool saturate=true)
Adds two source Images storing the result into a destination Image.
void Sub(const Image &src1, const Image &src2, Image &dst, DataType dst_type=DataType::none, bool saturate=true)
typename TypeInfo< DT >::basetype TypeInfo_t
promote_superior_type_t< TypeInfo_t< DT >, TypeInfo_t< DU > > promote_superior_type_dt
typename larger_arithmetic_type< T, U >::type larger_arithmetic_type_t
void Div(const Image &src1, const Image &src2, Image &dst, DataType dst_type=DataType::none, bool saturate=true)
typename arithmetic_superior_type< T, U >::type arithmetic_superior_type_t
typename std::conditional_t<(std::numeric_limits< T >::digits< std::numeric_limits< U >::digits), U, T > type