mirror of
https://github.com/opelly27/Stockfish.git
synced 2026-05-20 13:17:44 +00:00
Add PEXT software implementation
For development/debug purposes. No functional change.
This commit is contained in:
@@ -79,6 +79,23 @@ 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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user