Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Types | Static Public Member Functions | List of all members
base::internal::ClampedSubOp< 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::ClampedSubOp< T, U, typename std::enable_if< std::is_integral< T >::value &&std::is_integral< U >::value >::type >

Definition at line 100 of file clamped_math_impl.h.

Member Typedef Documentation

◆ result_type

template<typename T , typename U >
using base::internal::ClampedSubOp< 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 104 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::ClampedSubOp< 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 106 of file clamped_math_impl.h.

106 {
107 // TODO(jschuh) Make this "constexpr if" once we're C++17.
109 return ClampedSubFastOp<T, U>::template Do<V>(x, y);
110
111 static_assert(std::is_same<V, result_type>::value ||
113 "The saturation result cannot be determined from the "
114 "provided types.");
115 const V saturated = CommonMaxOrMin<V>(!IsValueNegative(y));
116 V result = {};
117 return BASE_NUMERICS_LIKELY((CheckedSubOp<T, U>::Do(x, y, &result)))
118 ? result
119 : saturated;
120 }
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: