Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Namespaces | Macros | Typedefs | Functions
safe_conversions.h File Reference
#include <cmath>
#include <cstddef>
#include <limits>
#include <type_traits>
#include "base/numerics/safe_conversions_impl.h"
#include <ostream>

Go to the source code of this file.

Classes

struct  base::internal::SaturateFastAsmOp< Dst, Src >
 
struct  base::internal::IsValueInRangeFastOp< Dst, Src, Enable >
 
struct  base::internal::IsValueInRangeFastOp< Dst, Src, typename std::enable_if< std::is_integral< Dst >::value &&std::is_integral< Src >::value &&std::is_signed< Dst >::value &&std::is_signed< Src >::value &&!IsTypeInRangeForNumericType< Dst, Src >::value >::type >
 
struct  base::internal::IsValueInRangeFastOp< Dst, Src, typename std::enable_if< std::is_integral< Dst >::value &&std::is_integral< Src >::value &&!std::is_signed< Dst >::value &&std::is_signed< Src >::value &&!IsTypeInRangeForNumericType< Dst, Src >::value >::type >
 
struct  base::internal::SaturationDefaultLimits< T >
 
struct  base::internal::SaturateFastOp< Dst, Src, Enable >
 
struct  base::internal::SaturateFastOp< Dst, Src, typename std::enable_if< std::is_integral< Src >::value &&std::is_integral< Dst >::value &&SaturateFastAsmOp< Dst, Src >::is_supported >::type >
 
struct  base::internal::SaturateFastOp< Dst, Src, typename std::enable_if< std::is_integral< Src >::value &&std::is_integral< Dst >::value &&!SaturateFastAsmOp< Dst, Src >::is_supported >::type >
 
struct  base::internal::IsNumericRangeContained< Dst, Src, Enable >
 
struct  base::internal::IsNumericRangeContained< Dst, Src, typename std::enable_if< ArithmeticOrUnderlyingEnum< Dst >::value &&ArithmeticOrUnderlyingEnum< Src >::value >::type >
 
class  base::internal::StrictNumeric< T >
 

Namespaces

namespace  base
 
namespace  base::internal
 

Macros

#define BASE_HAS_OPTIMIZED_SAFE_CONVERSIONS   (0)
 
#define BASE_NUMERIC_COMPARISON_OPERATORS(CLASS, NAME, OP)
 

Typedefs

using base::SizeT = StrictNumeric< size_t >
 

Functions

template<typename Dst , typename Src >
constexpr bool base::internal::IsValueInRangeForNumericType (Src value)
 
template<typename Dst , class CheckHandler = internal::CheckOnFailure, typename Src >
constexpr Dst base::internal::checked_cast (Src value)
 
template<typename Dst , template< typename > class S, typename Src >
constexpr Dst base::internal::saturated_cast_impl (Src value, RangeCheck constraint)
 
template<typename Dst , template< typename > class SaturationHandler = SaturationDefaultLimits, typename Src >
constexpr Dst base::internal::saturated_cast (Src value)
 
template<typename Dst , typename Src >
constexpr Dst base::internal::strict_cast (Src value)
 
template<typename T >
constexpr StrictNumeric< typename UnderlyingType< T >::typebase::internal::MakeStrictNum (const T value)
 
template<typename T >
std::ostream & base::internal::operator<< (std::ostream &os, const StrictNumeric< T > &value)
 
template<typename Dst = int, typename Src , typename = std::enable_if_t<std::is_integral<Dst>::value && std::is_floating_point<Src>::value>>
Dst base::ClampFloor (Src value)
 
template<typename Dst = int, typename Src , typename = std::enable_if_t<std::is_integral<Dst>::value && std::is_floating_point<Src>::value>>
Dst base::ClampCeil (Src value)
 
template<typename Dst = int, typename Src , typename = std::enable_if_t<std::is_integral<Dst>::value && std::is_floating_point<Src>::value>>
Dst base::ClampRound (Src value)
 

Macro Definition Documentation

◆ BASE_HAS_OPTIMIZED_SAFE_CONVERSIONS

#define BASE_HAS_OPTIMIZED_SAFE_CONVERSIONS   (0)

Definition at line 19 of file safe_conversions.h.

◆ BASE_NUMERIC_COMPARISON_OPERATORS

#define BASE_NUMERIC_COMPARISON_OPERATORS (   CLASS,
  NAME,
  OP 
)
Value:
template <typename L, typename R, \
typename std::enable_if< \
internal::Is##CLASS##Op<L, R>::value>::type* = nullptr> \
constexpr bool operator OP(const L lhs, const R rhs) { \
return SafeCompare<NAME, typename UnderlyingType<L>::type, \
typename UnderlyingType<R>::type>(lhs, rhs); \
}
#define R(r)

Definition at line 326 of file safe_conversions.h.

330 { \
331 return SafeCompare<NAME, typename UnderlyingType<L>::type, \
332 typename UnderlyingType<R>::type>(lhs, rhs); \
333 }