File tree 2 files changed +37
-8
lines changed
2 files changed +37
-8
lines changed Original file line number Diff line number Diff line change
1
+ name : MSVC Clang-CL Static Build
2
+
3
+ on :
4
+ push :
5
+ pull_request :
6
+
7
+ permissions :
8
+ contents : read # to fetch code (actions/checkout)
9
+
10
+ jobs :
11
+ build :
12
+ runs-on : windows-2019
13
+ env :
14
+ BUILD_TYPE : Release
15
+ steps :
16
+ - name : Checkout Repo
17
+ uses : actions/checkout@v4
18
+
19
+ - name : Build
20
+ run : |
21
+ cmake -B build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DZ3_BUILD_LIBZ3_SHARED=OFF -DZ3_BUILD_LIBZ3_MSVC_STATIC=ON -T ClangCL -DCMAKE_C_FLAGS="/EHsc" -DCMAKE_CXX_FLAGS="/EHsc"
22
+ cmake --build build --config ${{ env.BUILD_TYPE }} --parallel
23
+
Original file line number Diff line number Diff line change @@ -46,10 +46,14 @@ Revision History:
46
46
#define LEHMER_GCD
47
47
#endif
48
48
49
-
50
- #if defined(__GNUC__)
49
+ #ifdef __has_builtin
50
+ #define HAS_BUILTIN (X ) __has_builtin(X)
51
+ #else
52
+ #define HAS_BUILTIN (X ) 0
53
+ #endif
54
+ #if HAS_BUILTIN(__builtin_ctz)
51
55
#define _trailing_zeros32 (X ) __builtin_ctz(X)
52
- #elif defined(_WINDOWS) && (defined(_M_X86) || (defined(_M_X64) && !defined(_M_ARM64EC)))
56
+ #elif defined(_WINDOWS) && (defined(_M_X86) || (defined(_M_X64) && !defined(_M_ARM64EC))) && !defined(__clang__)
53
57
// This is needed for _tzcnt_u32 and friends.
54
58
#include < immintrin.h>
55
59
#define _trailing_zeros32 (X ) _tzcnt_u32(X)
@@ -62,11 +66,11 @@ static uint32_t _trailing_zeros32(uint32_t x) {
62
66
#endif
63
67
64
68
#if (defined(__LP64__) || defined(_WIN64)) && defined(_M_X64) && !defined(_M_ARM64EC)
65
- #if defined(__GNUC__ )
66
- #define _trailing_zeros64 (X ) __builtin_ctzll(X)
67
- # else
68
- #define _trailing_zeros64 (X ) _tzcnt_u64(X)
69
- #endif
69
+ #if HAS_BUILTIN(__builtin_ctzll )
70
+ #define _trailing_zeros64 (X ) __builtin_ctzll(X)
71
+ # elif !defined(__clang__)
72
+ #define _trailing_zeros64 (X ) _tzcnt_u64(X)
73
+ #endif
70
74
#else
71
75
static uint64_t _trailing_zeros64 (uint64_t x) {
72
76
uint64_t r = 0 ;
@@ -75,6 +79,8 @@ static uint64_t _trailing_zeros64(uint64_t x) {
75
79
}
76
80
#endif
77
81
82
+ #undef HAS_BUILTIN
83
+
78
84
unsigned trailing_zeros (uint32_t x) {
79
85
return static_cast <unsigned >(_trailing_zeros32 (x));
80
86
}
You can’t perform that action at this time.
0 commit comments