Flutter Engine
The Flutter Engine
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Namespaces | Macros | Functions | Variables
saturated_math.h File Reference
#include <algorithm>
#include <limits>
#include <type_traits>
#include "flutter/fml/logging.h"
#include "impeller/geometry/scalar.h"

Go to the source code of this file.

Namespaces

namespace  impeller
 
namespace  impeller::saturated
 

Macros

#define ONLY_ON_SIGNED_INT_RET(Type, Ret)
 
#define ONLY_ON_SIGNED_INT(Type)   ONLY_ON_SIGNED_INT_RET(Type, Type)
 
#define ONLY_ON_FLOAT_RET(Type, Ret)
 
#define ONLY_ON_FLOAT(Type)   ONLY_ON_FLOAT_RET(Type, Type)
 
#define ONLY_ON_FLOAT_TO_SIGNED_INT_RET(FPType, SIType, Ret)
 
#define ONLY_ON_FLOAT_TO_SIGNED_INT(FPType, SIType)    ONLY_ON_FLOAT_TO_SIGNED_INT_RET(FPType, SIType, SIType)
 
#define ONLY_ON_DIFFERING_FLOAT_RET(FPType1, FPType2, Ret)
 
#define ONLY_ON_DIFFERING_FLOAT(FPType1, FPType2)    ONLY_ON_DIFFERING_FLOAT_RET(FPType1, FPType2, FPType2)
 
#define ONLY_ON_SAME_TYPES_RET(Type1, Type2, Ret)
 
#define ONLY_ON_SAME_TYPES(Type1, Type2)    ONLY_ON_SAME_TYPES_RET(Type1, Type2, Type2)
 

Functions

 impeller::saturated::ONLY_ON_SIGNED_INT (SI) Add(SI location
 
 impeller::saturated::ONLY_ON_FLOAT (FP) Add(FP location
 
 impeller::saturated::ONLY_ON_SIGNED_INT_RET (SI, Scalar) AverageScalar(SI a
 
 impeller::saturated::ONLY_ON_SAME_TYPES (T, U) Cast(T v)
 
 impeller::saturated::ONLY_ON_FLOAT_TO_SIGNED_INT (FP, SI) Cast(FP v)
 
 impeller::saturated::ONLY_ON_DIFFERING_FLOAT (FP1, FP2) Cast(FP1 v)
 

Variables

template<typename T >
constexpr bool impeller::saturated::is_signed_integral_v
 
SI impeller::saturated::distance
 
SI impeller::saturated::lower
 
SI impeller::saturated::b
 

Macro Definition Documentation

◆ ONLY_ON_DIFFERING_FLOAT

#define ONLY_ON_DIFFERING_FLOAT (   FPType1,
  FPType2 
)     ONLY_ON_DIFFERING_FLOAT_RET(FPType1, FPType2, FPType2)

Definition at line 48 of file saturated_math.h.

◆ ONLY_ON_DIFFERING_FLOAT_RET

#define ONLY_ON_DIFFERING_FLOAT_RET (   FPType1,
  FPType2,
  Ret 
)
Value:
template <typename FPType1, typename FPType2> \
constexpr inline std::enable_if_t<std::is_floating_point_v<FPType1> && \
std::is_floating_point_v<FPType2> && \
!std::is_same_v<FPType1, FPType2>, \
Ret>

Definition at line 42 of file saturated_math.h.

◆ ONLY_ON_FLOAT

#define ONLY_ON_FLOAT (   Type)    ONLY_ON_FLOAT_RET(Type, Type)

Definition at line 33 of file saturated_math.h.

◆ ONLY_ON_FLOAT_RET

#define ONLY_ON_FLOAT_RET (   Type,
  Ret 
)
Value:
template <typename Type> \
constexpr inline std::enable_if_t<std::is_floating_point_v<Type>, Ret>

Definition at line 30 of file saturated_math.h.

◆ ONLY_ON_FLOAT_TO_SIGNED_INT

#define ONLY_ON_FLOAT_TO_SIGNED_INT (   FPType,
  SIType 
)     ONLY_ON_FLOAT_TO_SIGNED_INT_RET(FPType, SIType, SIType)

Definition at line 39 of file saturated_math.h.

◆ ONLY_ON_FLOAT_TO_SIGNED_INT_RET

#define ONLY_ON_FLOAT_TO_SIGNED_INT_RET (   FPType,
  SIType,
  Ret 
)
Value:
template <typename FPType, typename SIType> \
constexpr inline std::enable_if_t< \
std::is_floating_point_v<FPType> && is_signed_integral_v<SIType>, Ret>

Definition at line 35 of file saturated_math.h.

◆ ONLY_ON_SAME_TYPES

#define ONLY_ON_SAME_TYPES (   Type1,
  Type2 
)     ONLY_ON_SAME_TYPES_RET(Type1, Type2, Type2)

Definition at line 54 of file saturated_math.h.

◆ ONLY_ON_SAME_TYPES_RET

#define ONLY_ON_SAME_TYPES_RET (   Type1,
  Type2,
  Ret 
)
Value:
template <typename Type1, typename Type2> \
constexpr inline std::enable_if_t<std::is_same_v<Type1, Type2>, Ret>

Definition at line 51 of file saturated_math.h.

◆ ONLY_ON_SIGNED_INT

#define ONLY_ON_SIGNED_INT (   Type)    ONLY_ON_SIGNED_INT_RET(Type, Type)

Definition at line 28 of file saturated_math.h.

◆ ONLY_ON_SIGNED_INT_RET

#define ONLY_ON_SIGNED_INT_RET (   Type,
  Ret 
)
Value:
template <typename Type> \
constexpr inline std::enable_if_t<is_signed_integral_v<Type>, Ret>

Definition at line 25 of file saturated_math.h.