RCS file: /sources/gnugo/gnugo/engine/hash.h,v
retrieving revision 1.37
diff -u -r1.37 hash.h
|
|
|
|
| 87 | 87 | #define INIT_ZOBRIST_ARRAY(a) \ |
| 88 | 88 | hash_init_zobrist_array(a, (int) (sizeof(a) / sizeof(a[0]))) |
| 89 | 89 | |
| 90 | | void hashdata_clear(Hash_data *hd); |
| | 90 | inline void hashdata_clear(Hash_data *hd); |
| 91 | 91 | void hashdata_recalc(Hash_data *hd, Intersection *board, int ko_pos); |
| 92 | | void hashdata_invert_ko(Hash_data *hd, int pos); |
| 93 | | void hashdata_invert_stone(Hash_data *hd, int pos, int color); |
| 94 | | void hashdata_invert_komaster(Hash_data *hd, int komaster); |
| 95 | | void hashdata_invert_kom_pos(Hash_data *hd, int kom_pos); |
| | 92 | inline void hashdata_invert_ko(Hash_data *hd, int pos); |
| | 93 | inline void hashdata_invert_stone(Hash_data *hd, int pos, int color); |
| | 94 | inline void hashdata_invert_komaster(Hash_data *hd, int komaster); |
| | 95 | inline void hashdata_invert_kom_pos(Hash_data *hd, int kom_pos); |
| 96 | 96 | |
| 97 | 97 | char *hashdata_to_string(Hash_data *hashdata); |
| 98 | 98 | |
| … |
… |
|
| 100 | 100 | |
| 101 | 101 | /* ---------------------------------------------------------------- */ |
| 102 | 102 | |
| 103 | | /* There is no need to involve all bits in the remainder computation |
| 104 | | * as long as we only use it to compute a key into a hash table. 32 |
| 105 | | * random bits are sufficient to get an even distribution within any |
| 106 | | * hashtable of reasonable size. By never using more than 32 bits we |
| 107 | | * also reduce the platform dependency of the GNU Go engine. |
| 108 | | */ |
| | 103 | /* Calculates a place in the transposition table where to look up for |
| | 104 | a hash value. If sizeof(long) > sizeof(int) we truncate long to int |
| | 105 | because size of the transposition table wouldn't be greater than |
| | 106 | int. */ |
| 109 | 107 | #define hashdata_remainder(hd, num) \ |
| 110 | | (((hd).hashval[0] & 0xffffffffU) % (num)) |
| | 108 | (*((unsigned int*)((hd).hashval)) % (num)) |
| | 109 | |
| 111 | 110 | |
| 112 | 111 | #if NUM_HASHVALUES == 1 |
| 113 | 112 | |
| … |
… |
|
| 139 | 138 | #define hashdata_xor(hd1, hd2) \ |
| 140 | 139 | do { \ |
| 141 | 140 | int i; \ |
| 142 | | for (i = 0; i < NUM_HASHVALUES; i++) \ |
| | 141 | for (i = 0; i < NUM_HASHVALUES; ++i) \ |
| 143 | 142 | (hd1).hashval[i] ^= (hd2).hashval[i]; \ |
| 144 | 143 | } while (0) |
| 145 | 144 | |