summaryrefslogtreecommitdiff
path: root/deps/v8/src/base/division-by-constant.h
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/base/division-by-constant.h')
-rw-r--r--deps/v8/src/base/division-by-constant.h33
1 files changed, 22 insertions, 11 deletions
diff --git a/deps/v8/src/base/division-by-constant.h b/deps/v8/src/base/division-by-constant.h
index 5d063f8bd5..744283981b 100644
--- a/deps/v8/src/base/division-by-constant.h
+++ b/deps/v8/src/base/division-by-constant.h
@@ -8,6 +8,7 @@
#include <stdint.h>
#include "src/base/base-export.h"
+#include "src/base/export-template.h"
namespace v8 {
namespace base {
@@ -18,7 +19,7 @@ namespace base {
// Delight", chapter 10. The template parameter must be one of the unsigned
// integral types.
template <class T>
-struct V8_BASE_EXPORT MagicNumbersForDivision {
+struct EXPORT_TEMPLATE_DECLARE(V8_BASE_EXPORT) MagicNumbersForDivision {
MagicNumbersForDivision(T m, unsigned s, bool a)
: multiplier(m), shift(s), add(a) {}
bool operator==(const MagicNumbersForDivision& rhs) const {
@@ -34,25 +35,35 @@ struct V8_BASE_EXPORT MagicNumbersForDivision {
// Calculate the multiplier and shift for signed division via multiplication.
// The divisor must not be -1, 0 or 1 when interpreted as a signed value.
template <class T>
-V8_BASE_EXPORT MagicNumbersForDivision<T> SignedDivisionByConstant(T d);
+EXPORT_TEMPLATE_DECLARE(V8_BASE_EXPORT)
+MagicNumbersForDivision<T> SignedDivisionByConstant(T d);
// Calculate the multiplier and shift for unsigned division via multiplication,
// see Warren's "Hacker's Delight", chapter 10. The divisor must not be 0 and
// leading_zeros can be used to speed up the calculation if the given number of
// upper bits of the dividend value are known to be zero.
template <class T>
-V8_BASE_EXPORT MagicNumbersForDivision<T> UnsignedDivisionByConstant(
+EXPORT_TEMPLATE_DECLARE(V8_BASE_EXPORT)
+MagicNumbersForDivision<T> UnsignedDivisionByConstant(
T d, unsigned leading_zeros = 0);
-extern template V8_BASE_EXPORT MagicNumbersForDivision<uint32_t>
-SignedDivisionByConstant(uint32_t d);
-extern template V8_BASE_EXPORT MagicNumbersForDivision<uint64_t>
-SignedDivisionByConstant(uint64_t d);
+// Explicit instantiation declarations.
+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 V8_BASE_EXPORT MagicNumbersForDivision<uint32_t>
-UnsignedDivisionByConstant(uint32_t d, unsigned leading_zeros);
-extern template V8_BASE_EXPORT MagicNumbersForDivision<uint64_t>
-UnsignedDivisionByConstant(uint64_t d, unsigned leading_zeros);
+extern template EXPORT_TEMPLATE_DECLARE(V8_BASE_EXPORT)
+ MagicNumbersForDivision<uint32_t> SignedDivisionByConstant(uint32_t d);
+extern template EXPORT_TEMPLATE_DECLARE(V8_BASE_EXPORT)
+ MagicNumbersForDivision<uint64_t> SignedDivisionByConstant(uint64_t d);
+
+extern template EXPORT_TEMPLATE_DECLARE(V8_BASE_EXPORT)
+ MagicNumbersForDivision<uint32_t> UnsignedDivisionByConstant(
+ uint32_t d, unsigned leading_zeros);
+extern template EXPORT_TEMPLATE_DECLARE(V8_BASE_EXPORT)
+ MagicNumbersForDivision<uint64_t> UnsignedDivisionByConstant(
+ uint64_t d, unsigned leading_zeros);
} // namespace base
} // namespace v8