mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 16:53:09 +00:00
Simplify lookup_count and clean up pieces().
https://github.com/official-stockfish/Stockfish/pull/4656 No functional change
This commit is contained in:
parent
8634717c64
commit
80564bcfcd
2 changed files with 4 additions and 12 deletions
|
@ -24,6 +24,7 @@
|
|||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <bitset>
|
||||
#include <type_traits>
|
||||
#include "../nnue_common.h"
|
||||
#include "affine_transform.h"
|
||||
|
@ -77,16 +78,7 @@ namespace Stockfish::Eval::NNUE::Layers {
|
|||
alignas(CacheLineSize) static inline const std::array<unsigned, 256> lookup_count = [](){
|
||||
std::array<unsigned, 256> v;
|
||||
for (int i = 0; i < 256; ++i)
|
||||
{
|
||||
int j = i;
|
||||
int k = 0;
|
||||
while(j)
|
||||
{
|
||||
j &= j - 1;
|
||||
++k;
|
||||
}
|
||||
v[i] = k;
|
||||
}
|
||||
v[i] = unsigned(std::bitset<8>(i).count());
|
||||
return v;
|
||||
}();
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ public:
|
|||
std::string fen() const;
|
||||
|
||||
// Position representation
|
||||
Bitboard pieces(PieceType pt) const;
|
||||
Bitboard pieces(PieceType pt = ALL_PIECES) const;
|
||||
template<typename ...PieceTypes> Bitboard pieces(PieceType pt, PieceTypes... pts) const;
|
||||
Bitboard pieces(Color c) const;
|
||||
template<typename ...PieceTypes> Bitboard pieces(Color c, PieceTypes... pts) const;
|
||||
|
@ -224,7 +224,7 @@ inline Piece Position::moved_piece(Move m) const {
|
|||
return piece_on(from_sq(m));
|
||||
}
|
||||
|
||||
inline Bitboard Position::pieces(PieceType pt = ALL_PIECES) const {
|
||||
inline Bitboard Position::pieces(PieceType pt) const {
|
||||
return byTypeBB[pt];
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue