summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
ca3622f)
This intrinsic to call BMI2 PEXT instruction is
defined in immintrin.h. This header should be
included only when USE_PEXT is defined, otherwise
we define _pext_u64 as 0 forcing a nop.
But under some mingw platforms, even if we don't
include the header, immintrin.h gets included
anyhow through an include chain that starts with
STL <algorithm> header. So we end up both defining
_pext_u64 function and at the same time defining
_pext_u64 as 0 leading to a compile error.
The correct solution is of not using _pext_u64 directly.
This patch fixes a compile error with some mingw64
package when compiling with x86-64.
No functional change.
reference[size] = sliding_attack(deltas, s, b);
if (HasPext)
reference[size] = sliding_attack(deltas, s, b);
if (HasPext)
- attacks[s][_pext_u64(b, masks[s])] = reference[size];
+ attacks[s][pext(b, masks[s])] = reference[size];
size++;
b = (b - masks[s]) & masks[s];
size++;
b = (b - masks[s]) & masks[s];
unsigned* const Shifts = Pt == ROOK ? RookShifts : BishopShifts;
if (HasPext)
unsigned* const Shifts = Pt == ROOK ? RookShifts : BishopShifts;
if (HasPext)
- return unsigned(_pext_u64(occupied, Masks[s]));
+ return unsigned(pext(occupied, Masks[s]));
if (Is64Bit)
return unsigned(((occupied & Masks[s]) * Magics[s]) >> Shifts[s]);
if (Is64Bit)
return unsigned(((occupied & Masks[s]) * Magics[s]) >> Shifts[s]);
#if defined(USE_PEXT)
# include <immintrin.h> // Header for _pext_u64() intrinsic
#if defined(USE_PEXT)
# include <immintrin.h> // Header for _pext_u64() intrinsic
+# define pext(b, m) _pext_u64(b, m)
-# define _pext_u64(b, m) (0)