chromium/third_party/pdfium/core/fxcrt/numerics/safe_math_clang_gcc_impl.h

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

#ifndef CORE_FXCRT_NUMERICS_SAFE_MATH_CLANG_GCC_IMPL_H_
#define CORE_FXCRT_NUMERICS_SAFE_MATH_CLANG_GCC_IMPL_H_

#include <cassert>
#include <limits>
#include <type_traits>

#include "core/fxcrt/numerics/safe_conversions.h"

#if !defined(__native_client__) && (defined(__ARMEL__) || defined(__arch64__))
#include "core/fxcrt/numerics/safe_math_arm_impl.h"
#define BASE_HAS_ASSEMBLER_SAFE_MATH
#else
#define BASE_HAS_ASSEMBLER_SAFE_MATH
#endif

namespace pdfium {
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 pdfium

#endif  // CORE_FXCRT_NUMERICS_SAFE_MATH_CLANG_GCC_IMPL_H_