The line of code I am interested in is
htable->word2 = word2 ^ word1;
There are two occurrences of this line in the last 5 lines of the code I copied
Thanks,
Eric Stock
Code: Select all
void HashStore(TREE * RESTRICT tree, int ply, int depth, int wtm, int type,
int value, int bestmove) {
register BITBOARD word1, word2;
register HASH_ENTRY *htable;
register int draft, age, hwhich;
/*
************************************************************
* *
* "Fill in the blank" and build a table entry from *
* current search information. *
* *
************************************************************
*/
word1 = transposition_id;
word1 = (word1 << 4) | type;
if (value > MATE - 300)
value += ply - 1;
else if (value < -MATE + 300)
value -= ply - 1;
word1 = (word1 << 25) | bestmove;
word1 = (word1 << 15) | depth;
word1 = (word1 << 17) | (value + 65536);
word2 = (wtm) ? HashKey : ~HashKey;
/*
************************************************************
* *
* If the draft of this entry is greater than the draft *
* of the entry in the "depth-priority" table, or if the *
* entry in the depth-priority table is from an old *
* search, move that entry to the always-store table and *
* then replace the depth-priority table entry by the new *
* hash result. *
* *
************************************************************
*/
htable = trans_ref + 3 * (word2 & hash_mask);
draft = (htable->word1 >> 17) & 0x7fff;
age = htable->word1 >> 61;
if (age != transposition_id || (depth >= draft)) {
if (word2 != (htable->word2 ^ htable->word1)) {
hwhich = (((htable->word2 ^ htable->word1) >> log_hash) & 1) + 1;
(htable + hwhich)->word1 = htable->word1;
(htable + hwhich)->word2 = htable->word2;
}
htable->word1 = word1;
htable->word2 = word2 ^ word1;
} else {
hwhich = ((word2 >> log_hash) & 1) + 1;
(htable + hwhich)->word1 = word1;
(htable + hwhich)->word2 = word2 ^ word1;
}
}