Author: Robert Hyatt

Date: 07:48:25 02/19/02

Go up one level in this thread

On February 19, 2002 at 02:36:32, Bernhard Bauer wrote: >On February 18, 2002 at 22:52:35, Robert Hyatt wrote: > >>On February 18, 2002 at 15:43:09, Alvaro Jose Povoa Cardoso wrote: >> >>>My program uses hash tables witch are a power of two. >>>In order to compute the index to an hash table of this kind I simply do: >>> hashindex=(hashkey & hashsize) >>>in witch hashsize is a mask with for example the first 12 bits set for a size of >>>4096 entries. >>>I would like to know how to compute the index to a hash table that can have >>>sizes like 1MB, 7MB, 45MB, 49MB, 50MB, ..etc >>>Could someone please explain how to do this? >>> >>>Thank you, >>>Alvaro Cardoso >> >> >>index = signature % hash_size > >If it's so easy, wouldn't it be nice to do it that way in Crafty? >That way many users could use a bigger hash size. >Kind regards >Bernhard It can be a killer. For example, old SPARC machines do not _have_ an integer divide instruction. So it would kill performance. Many newer processors do the integer divide far slower than the AND I use now. I haven't tested the speed difference in a long time, but on the sparc where Crafty started, it was huge because every divide turned into a procedure call.

- Re: Non power of two hash table sizes
**J. Wesley Cleveland***14:45:47 02/19/02*- Re: Non power of two hash table sizes
**Robert Hyatt***20:15:05 02/19/02*

- Re: Non power of two hash table sizes
- Re: Non power of two hash table sizes
**Gian-Carlo Pascutto***08:07:29 02/19/02*- Re: Non power of two hash table sizes
**Eugene Nalimov***22:14:12 02/19/02*- Re: Non power of two hash table sizes
**Dieter Buerssner***04:26:25 02/20/02*- Re: Non power of two hash table sizes
**Robert Hyatt***08:25:02 02/21/02*

- Re: Non power of two hash table sizes

- Re: Non power of two hash table sizes
- Re: Non power of two hash table sizes
**Robert Hyatt***11:01:28 02/19/02*

- Re: Non power of two hash table sizes

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.