mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-14 20:56:00 +08:00
Made TensorIntDiv.h compile with MSVC
This commit is contained in:
parent
27f3fb2bcc
commit
bffb6bdf45
@ -29,14 +29,16 @@ namespace Eigen {
|
|||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
// Note: result is undefined if val == 0
|
||||||
template <typename T>
|
template <typename T>
|
||||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE int count_leading_zeros(const T val)
|
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE int count_leading_zeros(const T val)
|
||||||
{
|
{
|
||||||
#ifndef __CUDA_ARCH__
|
#ifndef __CUDA_ARCH__
|
||||||
if (sizeof(T) == 8) {
|
return __builtin_clz(static_cast<uint32_t>(val));
|
||||||
return __builtin_clzl(val);
|
#elif EIGEN_COMP_MSVC
|
||||||
}
|
DWORD leading_zero = 0;
|
||||||
return __builtin_clz(val);
|
_BitScanReverse( &leading_zero, value);
|
||||||
|
return 31 - leading_zero;
|
||||||
#else
|
#else
|
||||||
return __clz(val);
|
return __clz(val);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user