diff options
author | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2016-03-09 07:06:36 -0800 |
---|---|---|
committer | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2016-03-09 07:06:36 -0800 |
commit | b084133dbfa089b8a8b6998df2c118ce3c20a7d5 (patch) | |
tree | 4fb007bec3970c943b43786faf1217ab9a745a01 /unsupported/Eigen/CXX11 | |
parent | 6d306831133f3b40b1946beac98d6fe083295126 (diff) |
Fixed the integer division code on windows
Diffstat (limited to 'unsupported/Eigen/CXX11')
-rw-r--r-- | unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h | 8 |
1 files changed, 7 insertions, 1 deletions
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) ? |