Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: To compress hashtable size? (Errata)

Author: Miguel A. Ballicora

Date: 11:34:32 07/14/01

Go up one level in this thread


On July 14, 2001 at 14:23:15, Miguel A. Ballicora wrote:

>On July 14, 2001 at 02:16:17, Bruce Moreland wrote:
>
>>On July 14, 2001 at 01:59:31, TEERAPONG TOVIRAT wrote:
>>
>>>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
>>
>>Use a 16-bit integer for the value and two chars for the other stuff.  That gets
>>you into 32-bits without screwing anything up.  Be forewarned that 16-bit
>>integers are evil, so don't use the things repeatedly in inner loop.  "Ooh,
>>these things are smaller, so the processor must like them better, so I'll make
>>all my ints into shorts whenever possible", is the utterance of someone who is
>>going to spend a confused afternoon wondering why they got 25% slower.
>>
>>Also, if you are going to use these things, put the two chars together so your
>>struct is char-char-word or word-char-char, but never char-word-char, which will
>>either cause the structure to pad (I believe to 48 bits in this case) or will
>>cause problems due to bad alignment if you get the structure to pack.
>
>This is clean and bug-free way to do it; however, since the padding or the
>absence of it is not guaranteed, I will add that the size of the hashtable entry
>should be checked with (sizeof HASH_STRUCTURE == WhateverWeExpect) and allocate
>the number of entries according to the result of sizeof rather than a #define
>value. Otherwise, it could break in some compiler.
>To force the padding I think that it could be done with a structure that

It should be read "to force NO PADDING"...

Regards,
Miguel




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.