#ifndef V8_BASE_DIVISION_BY_CONSTANT_H_
#define V8_BASE_DIVISION_BY_CONSTANT_H_
#include <stdint.h>
#include <tuple>
#include <type_traits>
#include "src/base/base-export.h"
#include "src/base/export-template.h"
namespace v8 {
namespace base {
template <class T>
struct EXPORT_TEMPLATE_DECLARE(V8_BASE_EXPORT) MagicNumbersForDivision { … };
template <class T, std::enable_if_t<std::is_unsigned_v<T>, bool> = true>
EXPORT_TEMPLATE_DECLARE(V8_BASE_EXPORT)
MagicNumbersForDivision<T> SignedDivisionByConstant(T d);
template <class T, std::enable_if_t<std::is_signed_v<T>, bool> = true>
MagicNumbersForDivision<T> SignedDivisionByConstant(T d) { … }
template <class T>
EXPORT_TEMPLATE_DECLARE(V8_BASE_EXPORT)
MagicNumbersForDivision<T> UnsignedDivisionByConstant(
T d, unsigned leading_zeros = 0);
extern template struct EXPORT_TEMPLATE_DECLARE(V8_BASE_EXPORT)
MagicNumbersForDivision<uint32_t>;
extern template struct EXPORT_TEMPLATE_DECLARE(V8_BASE_EXPORT)
MagicNumbersForDivision<uint64_t>;
extern template EXPORT_TEMPLATE_DECLARE(…)
MagicNumbersForDivision<uint32_t> SignedDivisionByConstant(uint32_t d);
extern template EXPORT_TEMPLATE_DECLARE(…)
MagicNumbersForDivision<uint64_t> SignedDivisionByConstant(uint64_t d);
extern template EXPORT_TEMPLATE_DECLARE(…)
MagicNumbersForDivision<uint32_t> UnsignedDivisionByConstant(
uint32_t d, unsigned leading_zeros);
extern template EXPORT_TEMPLATE_DECLARE(…)
MagicNumbersForDivision<uint64_t> UnsignedDivisionByConstant(
uint64_t d, unsigned leading_zeros);
}
}
#endif