Author: Bruce Moreland
Date: 23:16:17 07/13/01
Go up one level in this thread
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. Finally, watch out, because 16 bits is +/- 32767, and you could get killed on integer overflows if you have a mate score that's near there (as Steven J. Edwards has decreed in his EPD standard), especially if you ignore my other advice and use more of these dinky elements of death. bruce
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.