Mercurial > hg > xemacs-beta
comparison src/elhash.c @ 4779:fd98353950a4
Make my last change to elhash.c more kosher, comparing pointers not ints
2009-12-17 Aidan Kehoe <kehoea@parhasard.net>
* elhash.c (HASH_TABLE_DEFAULT_REHASH_THRESHOLD):
That last change was wrong in theory though not in practice; we're
comparing function pointers, not enumeration values.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Thu, 17 Dec 2009 17:29:32 +0000 |
parents | 0081fd36b783 |
children | e6dec75ded0e e0db3c197671 |
comparison
equal
deleted
inserted
replaced
4778:0081fd36b783 | 4779:fd98353950a4 |
---|---|
116 (*(EMACS_UINT*)(&((htentry)->value))) = 0) | 116 (*(EMACS_UINT*)(&((htentry)->value))) = 0) |
117 | 117 |
118 #define HASH_TABLE_DEFAULT_SIZE 16 | 118 #define HASH_TABLE_DEFAULT_SIZE 16 |
119 #define HASH_TABLE_DEFAULT_REHASH_SIZE 1.3 | 119 #define HASH_TABLE_DEFAULT_REHASH_SIZE 1.3 |
120 #define HASH_TABLE_MIN_SIZE 10 | 120 #define HASH_TABLE_MIN_SIZE 10 |
121 /* Casts are necessary here for VC++, though they shouldn't be. See | |
122 20a807210912170619nf13bbo8bee77a787961667@mail.gmail.com and the related | |
123 thread. */ | |
124 #define HASH_TABLE_DEFAULT_REHASH_THRESHOLD(size, test_function) \ | 121 #define HASH_TABLE_DEFAULT_REHASH_THRESHOLD(size, test_function) \ |
125 ((size) > 4096 && ((int)(test_function)) == (int)(HASH_TABLE_EQ) \ | 122 (((size) > 4096 && NULL == (test_function)) ? 0.7 : 0.6) |
126 ? 0.7 : 0.6) | |
127 | 123 |
128 #define HASHCODE(key, ht) \ | 124 #define HASHCODE(key, ht) \ |
129 ((((ht)->hash_function ? (ht)->hash_function (key) : LISP_HASH (key)) \ | 125 ((((ht)->hash_function ? (ht)->hash_function (key) : LISP_HASH (key)) \ |
130 * (ht)->golden_ratio) \ | 126 * (ht)->golden_ratio) \ |
131 % (ht)->size) | 127 % (ht)->size) |