mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 08:43:09 +00:00
Retire count_1s_8bit()
Use the plain array lookup in the only place where it is used. This remove an unecessary indirection and better clarifies what code does. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
1e4472b651
commit
4f7ec4128f
1 changed files with 1 additions and 12 deletions
|
@ -283,8 +283,6 @@ namespace {
|
||||||
inline Value apply_weight(Value v, int w);
|
inline Value apply_weight(Value v, int w);
|
||||||
Value scale_by_game_phase(Value mv, Value ev, Phase ph, const ScaleFactor sf[]);
|
Value scale_by_game_phase(Value mv, Value ev, Phase ph, const ScaleFactor sf[]);
|
||||||
|
|
||||||
int count_1s_8bit(Bitboard b);
|
|
||||||
|
|
||||||
int compute_weight(int uciWeight, int internalWeight);
|
int compute_weight(int uciWeight, int internalWeight);
|
||||||
int weight_option(const std::string& opt, int weight);
|
int weight_option(const std::string& opt, int weight);
|
||||||
void init_safety();
|
void init_safety();
|
||||||
|
@ -709,7 +707,7 @@ namespace {
|
||||||
Bitboard pawns = p.pawns(us) & this_and_neighboring_files_bb(s);
|
Bitboard pawns = p.pawns(us) & this_and_neighboring_files_bb(s);
|
||||||
Rank r = square_rank(s);
|
Rank r = square_rank(s);
|
||||||
for (int i = 1; i < 4; i++)
|
for (int i = 1; i < 4; i++)
|
||||||
shelter += count_1s_8bit(shiftRowsDown(pawns, r+i*sign)) * (128>>i);
|
shelter += BitCount8Bit[shiftRowsDown(pawns, r+i*sign) & 0xFF] * (128 >> i);
|
||||||
|
|
||||||
// Cache shelter value in pawn info
|
// Cache shelter value in pawn info
|
||||||
ei.pi->setKingShelter(us, s, shelter);
|
ei.pi->setKingShelter(us, s, shelter);
|
||||||
|
@ -1166,15 +1164,6 @@ namespace {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// count_1s_8bit() counts the number of nonzero bits in the 8 least
|
|
||||||
// significant bits of a Bitboard. This function is used by the king
|
|
||||||
// shield evaluation.
|
|
||||||
|
|
||||||
int count_1s_8bit(Bitboard b) {
|
|
||||||
return int(BitCount8Bit[b & 0xFF]);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// compute_weight() computes the value of an evaluation weight, by combining
|
// compute_weight() computes the value of an evaluation weight, by combining
|
||||||
// an UCI-configurable weight with an internal weight.
|
// an UCI-configurable weight with an internal weight.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue