From 3fd43cd5fcb22bb65bf2a92a25d95d801b11c9e0 Mon Sep 17 00:00:00 2001 From: Scott Gasch Date: Wed, 1 Jun 2016 18:58:58 -0700 Subject: Initial checkin for typhoon chess engine. --- src/pawnhash.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100755 src/pawnhash.c (limited to 'src/pawnhash.c') diff --git a/src/pawnhash.c b/src/pawnhash.c new file mode 100755 index 0000000..8af2138 --- /dev/null +++ b/src/pawnhash.c @@ -0,0 +1,53 @@ +/** + +Copyright (c) Scott Gasch + +Module Name: + + pawnhash.c + +Abstract: + + Pawn structure score hashing code. + +Author: + + Scott Gasch (scott.gasch@gmail.com) 14 Jun 2004 + +Revision History: + + $Id: pawnhash.c 345 2007-12-02 22:56:42Z scott $ + +**/ + +#include "chess.h" + + +PAWN_HASH_ENTRY * +PawnHashLookup(SEARCHER_THREAD_CONTEXT *ctx) +/** + +Routine description: + + Called by eval with a pointer to a POSITION, look in our pawn hash + to see if we have an entry that matches the pawn structure in the + POSITION. If so, "check out" that entry and return a pointer to + it. + + Note: there is a multi-probing scheme in place to remove + contention on MP machines. + +Parameters: + + POSITION *pos + +Return value: + + PAWN_HASH_ENTRY * + +**/ +{ + POSITION *pos = &(ctx->sPosition); + ULONG u = (ULONG)pos->u64PawnSig & (PAWN_HASH_TABLE_SIZE - 1); + return(&(ctx->rgPawnHash[u])); +} -- cgit v1.3