Fix windows clang compiling

_lzcnt_u64 may not supported by native LLVM compiler on Windows.
This commit is contained in:
Maxwell Geng 2025-08-07 14:12:36 +08:00 committed by GitHub
parent 639b73ecf9
commit dd71c5c6ac
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: B5690EEEBB952194

View file

@ -226,7 +226,7 @@ static inline size_t mi_clz(size_t x) {
size_t r; size_t r;
__asm ("lzcnt\t%1, %0" : "=r"(r) : "r"(x) : "cc"); __asm ("lzcnt\t%1, %0" : "=r"(r) : "r"(x) : "cc");
return r; return r;
#elif defined(_MSC_VER) && MI_ARCH_X64 && defined(__BMI1__) #elif defined(_MSC_VER) && !defined(__clang__) && MI_ARCH_X64 && defined(__BMI1__)
return _lzcnt_u64(x); return _lzcnt_u64(x);
#elif defined(_MSC_VER) && (MI_ARCH_X64 || MI_ARCH_X86 || MI_ARCH_ARM64 || MI_ARCH_ARM32) #elif defined(_MSC_VER) && (MI_ARCH_X64 || MI_ARCH_X86 || MI_ARCH_ARM64 || MI_ARCH_ARM32)
unsigned long idx; unsigned long idx;