Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Types | Static Public Member Functions | List of all members
base::internal::ClampedRshOp< 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 = T
 

Static Public Member Functions

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

Detailed Description

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

Definition at line 215 of file clamped_math_impl.h.

Member Typedef Documentation

◆ result_type

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

Definition at line 219 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::ClampedRshOp< T, U, typename std::enable_if< std::is_integral< T >::value &&std::is_integral< U >::value >::type >::Do ( T  x,
shift 
)
inlinestaticconstexpr

Definition at line 221 of file clamped_math_impl.h.

221 {
222 static_assert(!std::is_signed<U>::value, "Shift value must be unsigned.");
223 // Signed right shift is odd, because it saturates to -1 or 0.
224 const V saturated = as_unsigned(V(0)) - IsValueNegative(x);
226 ? saturated_cast<V>(x >> shift)
227 : saturated;
228 }
T __attribute__((ext_vector_type(N))) V
double x
constexpr bool IsValueNegative(T value)
constexpr std::make_unsigned< typenamebase::internal::UnderlyingType< Src >::type >::type as_unsigned(const Src value)
#define V(name)
Definition raw_object.h:124
#define BASE_NUMERICS_LIKELY(x)

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