aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h
diff options
context:
space:
mode:
authorGravatar Benoit Steiner <benoit.steiner.goog@gmail.com>2016-03-09 07:06:36 -0800
committerGravatar Benoit Steiner <benoit.steiner.goog@gmail.com>2016-03-09 07:06:36 -0800
commitb084133dbfa089b8a8b6998df2c118ce3c20a7d5 (patch)
tree4fb007bec3970c943b43786faf1217ab9a745a01 /unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h
parent6d306831133f3b40b1946beac98d6fe083295126 (diff)
Fixed the integer division code on windows
Diffstat (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h')
-rw-r--r--unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h8
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) ?