Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Types | Static Public Member Functions | List of all members
base::internal::ClampedAddOp< T, U, typename std::enable_if< std::is_integral< T >::value &&std::is_integral< U >::value >::type > Struct Template Reference

#include <clamped_math_impl.h>

Public Types

using result_type = typename MaxExponentPromotion< T, U >::type
 

Static Public Member Functions

template<typename V = result_type>
static constexpr V Do (T x, U y)
 

Detailed Description

template<typename T, typename U>
struct base::internal::ClampedAddOp< T, U, typename std::enable_if< std::is_integral< T >::value &&std::is_integral< U >::value >::type >

Definition at line 74 of file clamped_math_impl.h.

Member Typedef Documentation

◆ result_type

template<typename T , typename U >
using base::internal::ClampedAddOp< T, U, typename std::enable_if< std::is_integral< T >::value &&std::is_integral< U >::value >::type >::result_type = typename MaxExponentPromotion<T, U>::type

Definition at line 78 of file clamped_math_impl.h.

Member Function Documentation

◆ Do()

template<typename T , typename U >
template<typename V = result_type>
static constexpr V base::internal::ClampedAddOp< T, U, typename std::enable_if< std::is_integral< T >::value &&std::is_integral< U >::value >::type >::Do ( T  x,
y 
)
inlinestaticconstexpr

Definition at line 80 of file clamped_math_impl.h.

80 {
82 return ClampedAddFastOp<T, U>::template Do<V>(x, y);
83
84 static_assert(std::is_same<V, result_type>::value ||
86 "The saturation result cannot be determined from the "
87 "provided types.");
88 const V saturated = CommonMaxOrMin<V>(IsValueNegative(y));
89 V result = {};
90 return BASE_NUMERICS_LIKELY((CheckedAddOp<T, U>::Do(x, y, &result)))
91 ? result
92 : saturated;
93 }
GAsyncResult * result
T __attribute__((ext_vector_type(N))) V
double y
double x
constexpr bool IsValueNegative(T value)
#define BASE_NUMERICS_LIKELY(x)

The documentation for this struct was generated from the following file: