From b084133dbfa089b8a8b6998df2c118ce3c20a7d5 Mon Sep 17 00:00:00 2001 From: Benoit Steiner Date: Wed, 9 Mar 2016 07:06:36 -0800 Subject: Fixed the integer division code on windows --- unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (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 75567f1ff..33c6c1b0f 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h @@ -36,7 +36,13 @@ namespace { #ifdef __CUDA_ARCH__ return (sizeof(T) == 8) ? __clzll(val) : __clz(val); #elif EIGEN_COMP_MSVC - return (sizeof(T) == 8) ? __lzcnt64(val) : __lzcnt(val); + unsigned long index; + if (sizeof(T) == 8) { + _BitScanReverse64(&index, val); + } else { + _BitScanReverse(&index, val); + } + return (sizeof(T) == 8) ? 63 - index : 31 - index; #else EIGEN_STATIC_ASSERT(sizeof(unsigned long long) == 8, YOU_MADE_A_PROGRAMMING_MISTAKE); return (sizeof(T) == 8) ? -- cgit v1.2.3