@@ -115,12 +115,7 @@ cdef extern from *:
115115 #define __Quicktions_trailing_zeros_ulong(x) __builtin_ctzg(x)
116116 #define __Quicktions_trailing_zeros_ullong(x) __builtin_ctzg(x)
117117 #endif
118- #elif defined(__GNUC__)
119- #define __Quicktions_HAS_FAST_CTZ 1
120- #define __Quicktions_trailing_zeros_uint(x) __builtin_ctz(x)
121- #define __Quicktions_trailing_zeros_ulong(x) __builtin_ctzl(x)
122- #define __Quicktions_trailing_zeros_ullong(x) __builtin_ctzll(x)
123- #elif defined(_MSC_VER) && SIZEOF_INT == 4 && SIZEOF_LONG == 4 && SIZEOF_LONG_LONG == 8
118+ #elif defined(_MSC_VER) && SIZEOF_INT == 4 && SIZEOF_LONG_LONG == 8
124119 /* Typical Windows config. */
125120 #define __Quicktions_HAS_FAST_CTZ 1
126121 #pragma intrinsic(_BitScanForward, _BitScanForward64)
@@ -129,16 +124,16 @@ cdef extern from *:
129124 _BitScanForward(&bits, x);
130125 return (int) bits;
131126 }
132- static CYTHON_INLINE int __Quicktions_trailing_zeros_ulong(uint32_t x) {
133- unsigned long bits;
134- _BitScanForward(&bits, x);
135- return (int) bits;
136- }
137127 static CYTHON_INLINE int __Quicktions_trailing_zeros_ullong(uint64_t x) {
138128 unsigned long bits;
139129 _BitScanForward64(&bits, x);
140130 return (int) bits;
141131 }
132+ #if SIZEOF_LONG == 4
133+ #define __Quicktions_trailing_zeros_ulong(x) __Quicktions_trailing_zeros_uint(x)
134+ #else
135+ #define __Quicktions_trailing_zeros_ulong(x) __Quicktions_trailing_zeros_ullong(x)
136+ #endif
142137 #endif
143138 #if !defined(__Quicktions_HAS_FAST_CTZ)
144139 #define __Quicktions_HAS_FAST_CTZ 0
0 commit comments