aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h
diff options
context:
space:
mode:
authorGravatar Benoit Steiner <benoit.steiner.goog@gmail.com>2015-07-29 10:02:42 -0700
committerGravatar Benoit Steiner <benoit.steiner.goog@gmail.com>2015-07-29 10:02:42 -0700
commit099597406ff022bc29311fd3246d749dc04bd861 (patch)
tree9492ac06f87cdef0a1056b571cbe18c354e72717 /unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h
parent6db3a557f4734db4f9c8ed784541d556d5180339 (diff)
Simplified and generalized the DividerTraits code
Diffstat (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h')
-rw-r--r--unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h21
1 files changed, 1 insertions, 20 deletions
diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h b/unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h
index e44678226..b2e570ed1 100644
--- a/unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h
+++ b/unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h
@@ -57,32 +57,13 @@ namespace {
template <typename T>
struct DividerTraits {
#if defined(__SIZEOF_INT128__) && !defined(__CUDACC__)
- typedef T type;
+ typedef typename conditional<sizeof(T) == 8, uint64_t, uint32_t>::type type;
static const int N = sizeof(T) * 8;
#else
typedef uint32_t type;
static const int N = 32;
#endif
};
- template <>
- struct DividerTraits<int32_t> {
- typedef uint32_t type;
- static const int N = 32;
- };
- template <>
- struct DividerTraits<int64_t> {
-#if defined(__SIZEOF_INT128__) && !defined(__CUDACC__)
- typedef uint64_t type;
- static const int N = 64;
-#else
- typedef uint32_t type;
- static const int N = 32;
-#endif
- };
- // In C++, long is not int32_t nor int64_t, so we need a specialization for it:
- template <>
- struct DividerTraits<long> : internal::conditional<sizeof(long)==4,DividerTraits<int32_t>,DividerTraits<int64_t> >::type
- {};
template <typename T>
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE uint32_t muluh(const uint32_t a, const T b) {