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

Static Public Member Functions

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

Detailed Description

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

Definition at line 280 of file checked_math_impl.h.

Member Typedef Documentation

◆ result_type

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

Definition at line 284 of file checked_math_impl.h.

Member Function Documentation

◆ Do()

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

Definition at line 286 of file checked_math_impl.h.

286 {
287 // Disallow negative numbers and verify the shift is in bounds.
289 as_unsigned(shift) <
290 as_unsigned(std::numeric_limits<T>::digits))) {
291 // Shift as unsigned to avoid undefined behavior.
292 *result = static_cast<V>(as_unsigned(x) << shift);
293 // If the shift can be reversed, we know it was valid.
294 return *result >> shift == x;
295 }
296
297 // Handle the legal corner-case of a full-width signed shift of zero.
298 return std::is_signed<T>::value && !x &&
299 as_unsigned(shift) == as_unsigned(std::numeric_limits<T>::digits);
300 }
GAsyncResult * result
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 BASE_NUMERICS_LIKELY(x)

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