5#ifndef BASE_NUMERICS_SAFE_MATH_CLANG_GCC_IMPL_H_
6#define BASE_NUMERICS_SAFE_MATH_CLANG_GCC_IMPL_H_
14#if !defined(__native_client__) && (defined(__ARMEL__) || defined(__arch64__))
16#define BASE_HAS_ASSEMBLER_SAFE_MATH (1)
18#define BASE_HAS_ASSEMBLER_SAFE_MATH (0)
26#if !BASE_HAS_ASSEMBLER_SAFE_MATH
27template <
typename T,
typename U>
28struct CheckedMulFastAsmOp {
31 static constexpr bool Do(
T,
U,
V*) {
33 return CheckOnFailure::template HandleFailure<bool>();
37template <
typename T,
typename U>
38struct ClampedAddFastAsmOp {
43 return CheckOnFailure::template HandleFailure<V>();
47template <
typename T,
typename U>
48struct ClampedSubFastAsmOp {
53 return CheckOnFailure::template HandleFailure<V>();
57template <
typename T,
typename U>
58struct ClampedMulFastAsmOp {
63 return CheckOnFailure::template HandleFailure<V>();
67#undef BASE_HAS_ASSEMBLER_SAFE_MATH
69template <
typename T,
typename U>
74 return !__builtin_add_overflow(
x,
y,
result);
78template <
typename T,
typename U>
83 return !__builtin_sub_overflow(
x,
y,
result);
87template <
typename T,
typename U>
102 template <
typename V>
106 : !__builtin_mul_overflow(
x,
y,
result);
110template <
typename T,
typename U>
113 template <
typename V>
119template <
typename T,
typename U>
122 template <
typename V>
128template <
typename T,
typename U>
131 template <
typename V>
static float max(float r, float g, float b)
T __attribute__((ext_vector_type(N))) V
static const bool is_supported
static constexpr bool Do(T, U, V *)
__attribute__((always_inline)) static const expr bool Do(T x
static constexpr bool Do(T, U, V *)
static const bool is_supported
__attribute__((always_inline)) static const expr bool Do(T x
static const bool is_supported
static constexpr bool Do(T, U, V *)
static constexpr bool Do(T, U, V *)
static const bool is_supported
__attribute__((always_inline)) static const expr bool Do(T x
static const bool is_supported
static constexpr V Do(T, U)
static const bool is_supported
static constexpr V Do(T, U)
__attribute__((always_inline)) static V Do(T x
static const bool is_supported
static constexpr V Do(T, U)
__attribute__((always_inline)) static V Do(T x
static constexpr V Do(T, U)
static const bool is_supported
static const bool is_supported
__attribute__((always_inline)) static T Do(T value)
static const bool is_supported
static constexpr V Do(T, U)
static const bool is_supported
static constexpr V Do(T, U)
__attribute__((always_inline)) static V Do(T x