Author: Ron Murawski
Date: 10:46:10 11/08/02
Go up one level in this thread
On November 08, 2002 at 12:50:41, J. Wesley Cleveland wrote: >On November 08, 2002 at 10:50:34, Ron Murawski wrote: > >[snip] >> >>I'm investigating power-of-two size vs prime size using single-probes. It's not >>at all apparent to me whether the smaller table used for a power-of-two size >>might slow down the engine more than the expensive mod instruction on a larger >>table would. In other words, if there are 36K slots available, power-of-two >>would only use 32K slots, whereas the prime size would use almost all of the >>36K. > >You can use multiply instead of mod, e.g. with 32 bit keys: > >table_index = (key*number_of_table_slots) >> 32; I use a 64-bit key, so that wouldn't work so well for me. It seems to me that: table_index = ((key>>32)*number_of_table_slots) >> 32; should work, but it is somewhat complex and the entire expression will be calculated in 64-bit math. I wonder if a single mod might not be cheaper than the two 32 bit shifts. It would depend on the compiler's optimizations. This might be faster but is somewhat mysterious: table_index = ((key&4294967295)*number_of_table_slots) & 4294967295; where 4294967295 = 2^32 - 1 Ron
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.