chromium/base/numerics/safe_math_clang_gcc_impl.h

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef BASE_NUMERICS_SAFE_MATH_CLANG_GCC_IMPL_H_
#define BASE_NUMERICS_SAFE_MATH_CLANG_GCC_IMPL_H_

// IWYU pragma: private

#include <stdint.h>
#include <limits>
#include <type_traits>

#include "base/numerics/safe_conversions.h"

#if !defined(__native_client__) && (defined(__ARMEL__) || defined(__arch64__))
#include "base/numerics/safe_math_arm_impl.h"  // IWYU pragma: export
#define BASE_HAS_ASSEMBLER_SAFE_MATH
#else
#define BASE_HAS_ASSEMBLER_SAFE_MATH
#endif

namespace base {
namespace internal {

// These are the non-functioning boilerplate implementations of the optimized
// safe math routines.
#if !BASE_HAS_ASSEMBLER_SAFE_MATH
template <typename T, typename U>
struct CheckedMulFastAsmOp {};

template <typename T, typename U>
struct ClampedAddFastAsmOp {};

template <typename T, typename U>
struct ClampedSubFastAsmOp {};

template <typename T, typename U>
struct ClampedMulFastAsmOp {};
#endif  // BASE_HAS_ASSEMBLER_SAFE_MATH
#undef BASE_HAS_ASSEMBLER_SAFE_MATH

template <typename T, typename U>
struct CheckedAddFastOp {};

template <typename T, typename U>
struct CheckedSubFastOp {};

template <typename T, typename U>
struct CheckedMulFastOp {};

template <typename T, typename U>
struct ClampedAddFastOp {};

template <typename T, typename U>
struct ClampedSubFastOp {};

template <typename T, typename U>
struct ClampedMulFastOp {};

template <typename T>
struct ClampedNegFastOp {};

}  // namespace internal
}  // namespace base

#endif  // BASE_NUMERICS_SAFE_MATH_CLANG_GCC_IMPL_H_