mirror of
https://github.com/Z3Prover/z3
synced 2025-06-14 18:06:15 +00:00
Improve platform detection, in particular MSVC ARM64
This commit is contained in:
parent
907ffde577
commit
3feb1479c9
3 changed files with 13 additions and 7 deletions
|
@ -46,18 +46,17 @@ Revision History:
|
|||
#define LEHMER_GCD
|
||||
#endif
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#if defined(_WINDOWS) && !defined(_M_ARM) && !defined(_M_ARM64)
|
||||
// This is needed for _tzcnt_u32 and friends.
|
||||
#include <immintrin.h>
|
||||
#define _trailing_zeros32(X) _tzcnt_u32(X)
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#define _trailing_zeros32(X) __builtin_ctz(X)
|
||||
#else
|
||||
#define _trailing_zeros32(X) _tzcnt_u32(X)
|
||||
#endif
|
||||
|
||||
#if defined(__LP64__) || defined(_WIN64)
|
||||
#if (defined(__LP64__) || defined(_WIN64)) && !defined(_M_ARM) && !defined(_M_ARM64)
|
||||
#if defined(__GNUC__)
|
||||
#define _trailing_zeros64(X) __builtin_ctzll(X)
|
||||
#else
|
||||
|
@ -69,6 +68,11 @@ inline uint64_t _trailing_zeros64(uint64_t x) {
|
|||
for (; 0 == (x & 1) && r < 64; ++r, x >>= 1);
|
||||
return r;
|
||||
}
|
||||
inline uint32_t _trailing_zeros32(uint32_t x) {
|
||||
uint32_t r = 0;
|
||||
for (; 0 == (x & 1) && r < 32; ++r, x >>= 1);
|
||||
return r;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue