From 0570594f2c0c9fd241ff76f741d034e1daf106f9 Mon Sep 17 00:00:00 2001 From: Benoit Steiner Date: Wed, 29 Jul 2015 11:48:38 -0700 Subject: Fixed a few compilation warnings triggered by clang --- unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h') diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h b/unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h index b2e570ed1..7cdef6bc5 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h @@ -54,10 +54,15 @@ namespace { #endif } + template + struct UnsignedTraits { + typedef typename conditional::type type; + }; + template struct DividerTraits { #if defined(__SIZEOF_INT128__) && !defined(__CUDACC__) - typedef typename conditional::type type; + typedef typename UnsignedTraits::type type; static const int N = sizeof(T) * 8; #else typedef uint32_t type; @@ -125,14 +130,14 @@ struct TensorIntDivisor { // the __uint128_t type. EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorIntDivisor(const T divider) { const int N = DividerTraits::N; - eigen_assert(divider < NumTraits::highest()/2); + eigen_assert(static_cast::type>(divider) < NumTraits::highest()/2); eigen_assert(divider > 0); // fast ln2 const int leading_zeros = count_leading_zeros(static_cast(divider)); int log_div = N - leading_zeros; // if divider is a power of two then log_div is 1 more than it should be. - if ((1ull << (log_div-1)) == divider) + if ((static_cast::type>(1) << (log_div-1)) == static_cast::type>(divider)) log_div--; multiplier = DividerHelper::computeMultiplier(log_div, divider); @@ -143,7 +148,7 @@ struct TensorIntDivisor { // Must have 0 <= numerator. On platforms that dont support the __uint128_t // type numerator should also be less than 2^32-1. EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T divide(const T numerator) const { - eigen_assert(numerator < NumTraits::highest()/2); + eigen_assert(static_cast::type>(numerator) < NumTraits::highest()/2); eigen_assert(numerator >= 0); UnsignedType t1 = muluh(multiplier, numerator); -- cgit v1.2.3