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

#include <checked_math_impl.h>

Public Types

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

Static Public Member Functions

template<typename V >
static constexpr bool Do (T x, U y, V *result)
 

Detailed Description

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

Definition at line 207 of file checked_math_impl.h.

Member Typedef Documentation

◆ result_type

template<typename T , typename U >
using base::internal::CheckedDivOp< 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 211 of file checked_math_impl.h.

Member Function Documentation

◆ Do()

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

Definition at line 213 of file checked_math_impl.h.

213 {
215 return false;
216
217 // The overflow check can be compiled away if we don't have the exact
218 // combination of types needed to trigger this case.
219 using Promotion = typename BigEnoughPromotion<T, U>::type;
221 (std::is_signed<T>::value && std::is_signed<U>::value &&
223 static_cast<Promotion>(x) ==
224 std::numeric_limits<Promotion>::lowest() &&
225 y == static_cast<U>(-1)))) {
226 return false;
227 }
228
229 // This branch always compiles away if the above branch wasn't removed.
230 if (BASE_NUMERICS_UNLIKELY((!IsValueInRangeForNumericType<Promotion>(x) ||
231 !IsValueInRangeForNumericType<Promotion>(y)) &&
232 x)) {
233 return false;
234 }
235
236 Promotion presult = Promotion(x) / Promotion(y);
237 *result = static_cast<V>(presult);
238 return IsValueInRangeForNumericType<V>(presult);
239 }
GAsyncResult * result
T __attribute__((ext_vector_type(N))) V
double y
double x
#define BASE_NUMERICS_UNLIKELY(x)

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