Ticket #145: hash.h.patch

File hash.h.patch, 2.1 kB (added by draqo, 2 years ago)
  • gnugo/engine/hash.h

    RCS file: /sources/gnugo/gnugo/engine/hash.h,v
    retrieving revision 1.37
    diff -u -r1.37 hash.h
     
    8787#define INIT_ZOBRIST_ARRAY(a) \ 
    8888  hash_init_zobrist_array(a, (int) (sizeof(a) / sizeof(a[0]))) 
    8989 
    90 void hashdata_clear(Hash_data *hd); 
     90inline void hashdata_clear(Hash_data *hd); 
    9191void 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); 
     92inline void hashdata_invert_ko(Hash_data *hd, int pos); 
     93inline void hashdata_invert_stone(Hash_data *hd, int pos, int color); 
     94inline void hashdata_invert_komaster(Hash_data *hd, int komaster); 
     95inline void hashdata_invert_kom_pos(Hash_data *hd, int kom_pos); 
    9696 
    9797char *hashdata_to_string(Hash_data *hashdata); 
    9898 
     
    100100 
    101101/* ---------------------------------------------------------------- */ 
    102102 
    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. */ 
    109107#define hashdata_remainder(hd, num) \ 
    110   (((hd).hashval[0] & 0xffffffffU) % (num)) 
     108  (*((unsigned int*)((hd).hashval)) % (num)) 
     109 
    111110 
    112111#if NUM_HASHVALUES == 1 
    113112 
     
    139138#define hashdata_xor(hd1, hd2) \ 
    140139   do { \ 
    141140    int i; \ 
    142     for (i = 0; i < NUM_HASHVALUES; i++) \ 
     141    for (i = 0; i < NUM_HASHVALUES; ++i) \ 
    143142      (hd1).hashval[i] ^= (hd2).hashval[i]; \ 
    144143   } while (0) 
    145144