mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-17 07:36:23 +08:00
Rewrite bit counting functions
Get rid of macros and use templates instead, this is safer and allows us fix the warning: ISO C++ forbids braced-groups within expressions That broke compilation with -pedantic flag under gcc and POPCNT enabled. No functional and no performance change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -404,7 +404,7 @@ namespace {
|
||||
}
|
||||
|
||||
for (Bitboard b = 0ULL; b < 256ULL; b++)
|
||||
BitCount8Bit[b] = (uint8_t)count_1s(b);
|
||||
BitCount8Bit[b] = (uint8_t)count_1s<CNT32>(b);
|
||||
}
|
||||
|
||||
int remove_bit_8(int i) { return ((i & ~15) >> 1) | (i & 7); }
|
||||
@@ -494,7 +494,7 @@ namespace {
|
||||
Bitboard index_to_bitboard(int index, Bitboard mask) {
|
||||
|
||||
Bitboard result = 0ULL;
|
||||
int bits = count_1s(mask);
|
||||
int bits = count_1s<CNT32>(mask);
|
||||
|
||||
for (int i = 0; i < bits; i++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user