Author: Eric Oldre
Date: 14:12:00 06/20/04
I'm trying to implement a hash table in my engine. so i've been looking at code from some other engines to get a better idea how they work. In the VB.Net version of my engine i just used the HashTable object built into the .net framework. Not being able to rely on those types of built in objects is forcing me to learn alot of new programming techniques. I'm going to use some code from fruit 1.5 as an example here, to demostrate something that is confusing me. also, congratulations are due to fabien for making an engine that is both strong and is a great learning tool for less advanced chess programmers like me. //from trans_alloc trans->size = size + (ClusterSize - 1); trans->mask = size - 1; //later trans->table = (entry_t *) my_malloc(trans->size*sizeof(entry_t)); //from trans_retrieve entry = &trans->table[key&trans->mask]; lets pretend we had a size=33; then the trans->mask would be 32 or 100000 in binary. so if we take the key from the board, which should be a random like 64 bit number, the result of key&trans->mask would either be 0 or 32. leaving only 2 possible places that the entry could be at. my understanding of how hash tables work is that you would want to take the key, divide by the table size, take the remainder, and that would be the address that you should start looking for the entry at. i hope you can see what i'm getting at. is getting the remainder of division operations a slow process on 64 bit numbers? and that is why that method would not be used? if anyone could help explain this to me it would help out alot. Thanks, Eric Oldre I hope you can understand what i'm trying to say, it could be that this is just a different type of implementation that i don't understand too.
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.