mirror of
https://github.com/neovim/neovim.git
synced 2024-12-23 20:55:18 -07:00
build: fix link error for _BitScanForward64
(#28173)
Problem: The usage of `_BitScanForward64` causes linking to fail on some systems. Solution: Correctly check if it exists using `check_c_source_compiles`.
This commit is contained in:
parent
dc69c475a5
commit
75b80516d5
@ -79,6 +79,17 @@ int main(void)
|
|||||||
}
|
}
|
||||||
" HAVE_PWD_FUNCS)
|
" HAVE_PWD_FUNCS)
|
||||||
|
|
||||||
|
check_c_source_compiles("
|
||||||
|
#include <intrin.h>
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
unsigned long index;
|
||||||
|
unsigned char mask = 0x8000;
|
||||||
|
_BitScanForward64(&index, mask);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
" HAVE_BITSCANFORWARD64)
|
||||||
|
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
|
if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
|
||||||
check_c_source_compiles("
|
check_c_source_compiles("
|
||||||
|
@ -52,3 +52,4 @@
|
|||||||
#cmakedefine HAVE_EXECINFO_BACKTRACE
|
#cmakedefine HAVE_EXECINFO_BACKTRACE
|
||||||
#cmakedefine HAVE_BUILTIN_ADD_OVERFLOW
|
#cmakedefine HAVE_BUILTIN_ADD_OVERFLOW
|
||||||
#cmakedefine HAVE_WIMPLICIT_FALLTHROUGH_FLAG
|
#cmakedefine HAVE_WIMPLICIT_FALLTHROUGH_FLAG
|
||||||
|
#cmakedefine HAVE_BITSCANFORWARD64
|
||||||
|
@ -56,7 +56,7 @@ int xctz(uint64_t x)
|
|||||||
// Use compiler builtin if possible.
|
// Use compiler builtin if possible.
|
||||||
#if defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 4))
|
#if defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 4))
|
||||||
return __builtin_ctzll(x);
|
return __builtin_ctzll(x);
|
||||||
#elif defined(_MSC_VER)
|
#elif defined(HAVE_BITSCANFORWARD64)
|
||||||
unsigned long index;
|
unsigned long index;
|
||||||
_BitScanForward64(&index, x);
|
_BitScanForward64(&index, x);
|
||||||
return (int)index;
|
return (int)index;
|
||||||
|
Loading…
Reference in New Issue
Block a user