mirror of
https://github.com/sockspls/badfish
synced 2025-04-29 16:23:09 +00:00
Don't need to memset() EvalInfo
Set manually to zero the few fields that are optionally populated and that's enough. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
d73eea3f71
commit
17d820e248
1 changed files with 6 additions and 6 deletions
|
@ -23,7 +23,6 @@
|
||||||
////
|
////
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cstring>
|
|
||||||
|
|
||||||
#include "bitcount.h"
|
#include "bitcount.h"
|
||||||
#include "evaluate.h"
|
#include "evaluate.h"
|
||||||
|
@ -248,8 +247,6 @@ Value do_evaluate(const Position& pos, EvalInfo& ei) {
|
||||||
assert(pos.thread() >= 0 && pos.thread() < MAX_THREADS);
|
assert(pos.thread() >= 0 && pos.thread() < MAX_THREADS);
|
||||||
assert(!pos.is_check());
|
assert(!pos.is_check());
|
||||||
|
|
||||||
memset(&ei, 0, sizeof(EvalInfo));
|
|
||||||
|
|
||||||
// Initialize by reading the incrementally updated scores included in the
|
// Initialize by reading the incrementally updated scores included in the
|
||||||
// position object (material + piece square tables).
|
// position object (material + piece square tables).
|
||||||
ei.value = pos.value();
|
ei.value = pos.value();
|
||||||
|
@ -430,8 +427,8 @@ namespace {
|
||||||
ei.kingZone[Us] = (b | (Us == WHITE ? b >> 8 : b << 8));
|
ei.kingZone[Us] = (b | (Us == WHITE ? b >> 8 : b << 8));
|
||||||
ei.attackedBy[Us][PAWN] = ei.pi->pawn_attacks(Us);
|
ei.attackedBy[Us][PAWN] = ei.pi->pawn_attacks(Us);
|
||||||
b &= ei.attackedBy[Us][PAWN];
|
b &= ei.attackedBy[Us][PAWN];
|
||||||
if (b)
|
ei.kingAttackersCount[Us] = b ? count_1s_max_15<HasPopCnt>(b) / 2 : 0;
|
||||||
ei.kingAttackersCount[Us] = count_1s_max_15<HasPopCnt>(b) / 2;
|
ei.kingAdjacentZoneAttacksCount[Us] = ei.kingAttackersWeight[Us] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -475,6 +472,8 @@ namespace {
|
||||||
const Color Them = (Us == WHITE ? BLACK : WHITE);
|
const Color Them = (Us == WHITE ? BLACK : WHITE);
|
||||||
const Square* ptr = pos.piece_list_begin(Us, Piece);
|
const Square* ptr = pos.piece_list_begin(Us, Piece);
|
||||||
|
|
||||||
|
ei.attackedBy[Us][Piece] = 0;
|
||||||
|
|
||||||
while ((s = *ptr++) != SQ_NONE)
|
while ((s = *ptr++) != SQ_NONE)
|
||||||
{
|
{
|
||||||
// Find attacked squares, including x-ray attacks for bishops and rooks
|
// Find attacked squares, including x-ray attacks for bishops and rooks
|
||||||
|
@ -716,7 +715,8 @@ namespace {
|
||||||
// result in a score change far bigger than the value of the captured piece.
|
// result in a score change far bigger than the value of the captured piece.
|
||||||
ei.value -= Sign[Us] * KingDangerTable[Us][attackUnits];
|
ei.value -= Sign[Us] * KingDangerTable[Us][attackUnits];
|
||||||
ei.kingDanger[Us] = mg_value(KingDangerTable[Us][attackUnits]);
|
ei.kingDanger[Us] = mg_value(KingDangerTable[Us][attackUnits]);
|
||||||
}
|
} else
|
||||||
|
ei.kingDanger[Us] = VALUE_ZERO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue