Use calloc() in TranspositionTable::set_size()

Function calloc() already initializes memory to
zero, so avoid calling clear() afterwards.

Also some renaming while there (inspired by DiscoCheck).

No functional change.
This commit is contained in:
Marco Costalba
2013-06-29 10:23:43 +02:00
parent 17d41b3861
commit 203fdc9ac1
3 changed files with 42 additions and 44 deletions

View File

@@ -570,9 +570,9 @@ namespace {
&& tte
&& tte->depth() >= depth
&& ttValue != VALUE_NONE // Only in case of TT access race
&& ( PvNode ? tte->type() == BOUND_EXACT
: ttValue >= beta ? (tte->type() & BOUND_LOWER)
: (tte->type() & BOUND_UPPER)))
&& ( PvNode ? tte->bound() == BOUND_EXACT
: ttValue >= beta ? (tte->bound() & BOUND_LOWER)
: (tte->bound() & BOUND_UPPER)))
{
TT.refresh(tte);
ss->currentMove = ttMove; // Can be MOVE_NONE
@@ -601,8 +601,8 @@ namespace {
// Can ttValue be used as a better position evaluation?
if (ttValue != VALUE_NONE)
if ( ((tte->type() & BOUND_LOWER) && ttValue > eval)
|| ((tte->type() & BOUND_UPPER) && ttValue < eval))
if ( ((tte->bound() & BOUND_LOWER) && ttValue > eval)
|| ((tte->bound() & BOUND_UPPER) && ttValue < eval))
eval = ttValue;
}
else
@@ -775,7 +775,7 @@ split_point_start: // At split points actual search starts from here
&& depth >= (PvNode ? 6 * ONE_PLY : 8 * ONE_PLY)
&& ttMove != MOVE_NONE
&& !excludedMove // Recursive singular search is not allowed
&& (tte->type() & BOUND_LOWER)
&& (tte->bound() & BOUND_LOWER)
&& tte->depth() >= depth - 3 * ONE_PLY;
// Step 11. Loop through moves
@@ -1172,9 +1172,9 @@ split_point_start: // At split points actual search starts from here
if ( tte
&& tte->depth() >= ttDepth
&& ttValue != VALUE_NONE // Only in case of TT access race
&& ( PvNode ? tte->type() == BOUND_EXACT
: ttValue >= beta ? (tte->type() & BOUND_LOWER)
: (tte->type() & BOUND_UPPER)))
&& ( PvNode ? tte->bound() == BOUND_EXACT
: ttValue >= beta ? (tte->bound() & BOUND_LOWER)
: (tte->bound() & BOUND_UPPER)))
{
ss->currentMove = ttMove; // Can be MOVE_NONE
return ttValue;
@@ -1584,7 +1584,7 @@ split_point_start: // At split points actual search starts from here
void RootMove::extract_pv_from_tt(Position& pos) {
StateInfo state[MAX_PLY_PLUS_2], *st = state;
TTEntry* tte;
const TTEntry* tte;
int ply = 0;
Move m = pv[0];
@@ -1617,7 +1617,7 @@ void RootMove::extract_pv_from_tt(Position& pos) {
void RootMove::insert_pv_in_tt(Position& pos) {
StateInfo state[MAX_PLY_PLUS_2], *st = state;
TTEntry* tte;
const TTEntry* tte;
int ply = 0;
do {