Skip to content

Commit 34401fa

Browse files
committed
fix MSVC
1 parent fc7bbeb commit 34401fa

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

Objects/dictobject.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,22 @@ CountTrailingZeroesNonzero64(uint64_t x) {
192192
#define CTRL_DUMMY (0xFF) // -1
193193

194194
#if HAVE_SSE2
195+
#ifdef _MSC_VER
196+
__inline __m64
197+
_mm_set_pi64x (const __int64 i) {
198+
union {
199+
__int64 i;
200+
__m64 v;
201+
} u;
202+
203+
u.i = i;
204+
return u.v;
205+
}
206+
#endif
207+
195208
static inline uint64_t
196209
match_byte(uint64_t x, uint8_t n) {
197-
return _mm_movemask_pi8(_mm_cmpeq_pi8(_mm_set1_pi8(n), (__m64)x));
210+
return _mm_movemask_pi8(_mm_cmpeq_pi8(_mm_set1_pi8(n), _mm_set_pi64x(x)));
198211
}
199212

200213
static inline uint64_t
@@ -205,7 +218,7 @@ match_empty(uint64_t x) {
205218
static inline uint64_t
206219
match_empty_or_dummy(uint64_t x) {
207220
// A byte is EMPTY or DELETED iff the high bit is set
208-
return _mm_movemask_pi8((__m64)x);
221+
return _mm_movemask_pi8(_mm_set_pi64x(x));
209222
}
210223

211224
static inline int

0 commit comments

Comments
 (0)