Two Plus Two Publishing LLC Two Plus Two Publishing LLC
 

Go Back   Two Plus Two Poker Forums > Other Topics > Programming

Notices

Programming Discussions about computer programming

Reply
 
Thread Tools Display Modes
Old 04-20-2012, 03:07 PM   #1
adept
 
Join Date: Dec 2002
Posts: 945
Help with Paul Senzee's Perfect Hash

I'm trying to port to Pascal the perfect hash program used in Cactus Kev's hand evaluator, written as a patch by Paul Senzee:

// magic
unsigned find_fast(unsigned u)
{
unsigned a, b, r;
u += 0xe91aaa35;
u ^= u >> 16;
u += u << 8;
u ^= u >> 4;
b = (u >> 8) & 0x1ff;
a = (u + (u << 2)) >> 19;
r = a ^ hash_adjust[b];
return r;
}


The only problem I'm having is figuring out the source of the hash adjust table
given in the penultimate line: "r = a ^ hash_adjust[b];"

How exactly is hash_adjust populated? And I assume the "^" is an XOR of a and the b element in that table, correct?

Thanks for any help.
Insp. Clue!So? is offline   Reply With Quote
Old 04-20-2012, 04:01 PM   #2
adept
 
Join Date: Apr 2010
Location: Deep end of the player pool
Posts: 731
Re: Help with Paul Senzee's Perfect Hash

The array is hard coded, is it not?

Yes r should be the result of a XOR (element at b)
myNameIsInga is offline   Reply With Quote
Old 04-20-2012, 09:23 PM   #3
adept
 
Join Date: Apr 2011
Posts: 812
Re: Help with Paul Senzee's Perfect Hash

Quote:
Originally Posted by myNameIsInga View Post
The array is hard coded, is it not?
Yes.

http://code.google.com/p/typoker/sou...just.dat?r=129

http://code.google.com/p/typoker/sou...tor.java?r=129
au4all is offline   Reply With Quote
Old 04-21-2012, 02:34 PM   #4
adept
 
Join Date: Dec 2002
Posts: 945
Re: Help with Paul Senzee's Perfect Hash

Thanks folks!
Insp. Clue!So? is offline   Reply With Quote

Reply
      

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -4. The time now is 03:13 PM.


Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.6.0 ©2011, Crawlability, Inc.
Copyright © 2008-2010, Two Plus Two Interactive