mirror of
https://github.com/sockspls/badfish
synced 2025-07-13 04:29:15 +00:00
Add PEXT software implementation
For development/debug purposes. No functional change.
This commit is contained in:
parent
2f92e3b525
commit
2bfe61c33b
2 changed files with 19 additions and 0 deletions
|
@ -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.
|
/// 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.
|
/// pop_lsb() finds and clears the least significant bit in a non-zero bitboard.
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
|
extern Bitboard pext(Bitboard b, Bitboard mask);
|
||||||
|
|
||||||
namespace Bitboards {
|
namespace Bitboards {
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
|
|
Loading…
Add table
Reference in a new issue