mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-20 09:06:45 +08:00
Switch to hardware PEXT
Retire software pext and introduce hardware call when USE_PEXT is defined during compilation. This is a full complete implementation of sliding attacks using PEXT. No functional change.
This commit is contained in:
@@ -79,23 +79,6 @@ namespace {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Intel PEXT (parallel extraction) software implementation
|
||||
Bitboard pext(Bitboard b, Bitboard mask) {
|
||||
|
||||
Bitboard res = 0;
|
||||
|
||||
for (Bitboard bb = 1; mask; bb += bb)
|
||||
{
|
||||
if (b & mask & -mask)
|
||||
res |= bb;
|
||||
|
||||
mask &= mask - 1;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
/// lsb()/msb() finds the least/most significant bit in a non-zero bitboard.
|
||||
/// pop_lsb() finds and clears the least significant bit in a non-zero bitboard.
|
||||
|
||||
@@ -299,7 +282,7 @@ namespace {
|
||||
reference[size] = sliding_attack(deltas, s, b);
|
||||
|
||||
if (HasPext)
|
||||
attacks[s][pext(occupancy[size], masks[s])] = reference[size];
|
||||
attacks[s][_pext_u64(b, masks[s])] = reference[size];
|
||||
|
||||
size++;
|
||||
b = (b - masks[s]) & masks[s];
|
||||
|
||||
Reference in New Issue
Block a user