Author: Vincent Diepeveen
Date: 00:22:28 07/15/01
Go up one level in this thread
On July 14, 2001 at 01:59:31, TEERAPONG TOVIRAT wrote:
Make 2 functions that mess with this,
one that stores entries and one that retrieves entries.
In those 2 functions you can use difficult shifts then.
Don't mess with 16 bits or 8 bits values and don't mix
signed with unsigned too much in your program, just
for a lousy few % speedup. Just make everything
signed int in the program, with exception perhaps of the
hashing.
To store in an unsigned table use the trick to add a constant value
to the signed score :
int score=something;
unsigned int value1 = (depth<<25)|((score+constant)<<5);
Note in DIEP i had the hash as a 64 bits unsigned _int64
(or unsigned long long),
but i have removed that and rewritten it in
struct Hash {
unsigned int hi;
unsigned int lo;
}
This hash is about the only unsigned stuff in diep. The rest is 32 bits
signed int. I had all kind of bugs in DIEP in the past because of
either weird compiler behaviour, or simply bad casting from signed to
unsigned and from 8 bits to 32 bits.
It gets a mess if the size of your source code grows!
Note that 8 bits code might be pretty slow on the P4 anyway.
>Hi,
>
>I've been trying to reduce my hashtable size,so that I can gain
>more entries. At first,I try to pack three structure tag into one
>integer it looks like this...
>
> new integer = (flag<<a)|(depth<<b)|(value)
>
>It fails because value is signed int the rest are unsigned.
>Could anyone solve the problem?
>
>Thanks in advance,
>Teerapong
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.