Mercurial > hg > xemacs-beta
comparison src/elhash.c @ 394:7d59cb494b73 r21-2-12
Import from CVS: tag r21-2-12
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:11:37 +0200 |
parents | 8626e4521993 |
children | 74fd4e045ea6 |
comparison
equal
deleted
inserted
replaced
393:2e030b8965b1 | 394:7d59cb494b73 |
---|---|
45 size_t size; | 45 size_t size; |
46 size_t count; | 46 size_t count; |
47 size_t rehash_count; | 47 size_t rehash_count; |
48 double rehash_size; | 48 double rehash_size; |
49 double rehash_threshold; | 49 double rehash_threshold; |
50 size_t golden; | 50 size_t golden_ratio; |
51 hash_table_hash_function_t hash_function; | 51 hash_table_hash_function_t hash_function; |
52 hash_table_test_function_t test_function; | 52 hash_table_test_function_t test_function; |
53 hentry *hentries; | 53 hentry *hentries; |
54 enum hash_table_type type; /* whether and how this hash table is weak */ | 54 enum hash_table_type type; /* whether and how this hash table is weak */ |
55 Lisp_Object next_weak; /* Used to chain together all of the weak | 55 Lisp_Object next_weak; /* Used to chain together all of the weak |
64 #define HASH_TABLE_DEFAULT_REHASH_SIZE 1.3 | 64 #define HASH_TABLE_DEFAULT_REHASH_SIZE 1.3 |
65 #define HASH_TABLE_MIN_SIZE 10 | 65 #define HASH_TABLE_MIN_SIZE 10 |
66 | 66 |
67 #define HASH_CODE(key, ht) \ | 67 #define HASH_CODE(key, ht) \ |
68 (((((ht)->hash_function ? (ht)->hash_function (key) : LISP_HASH (key)) \ | 68 (((((ht)->hash_function ? (ht)->hash_function (key) : LISP_HASH (key)) \ |
69 * (ht)->golden) \ | 69 * (ht)->golden_ratio) \ |
70 % (ht)->size)) | 70 % (ht)->size)) |
71 | 71 |
72 #define KEYS_EQUAL_P(key1, key2, testfun) \ | 72 #define KEYS_EQUAL_P(key1, key2, testfun) \ |
73 (EQ ((key1), (key2)) || ((testfun) && (testfun) ((key1), (key2)))) | 73 (EQ ((key1), (key2)) || ((testfun) && (testfun) ((key1), (key2)))) |
74 | 74 |
397 static void | 397 static void |
398 compute_hash_table_derived_values (Lisp_Hash_Table *ht) | 398 compute_hash_table_derived_values (Lisp_Hash_Table *ht) |
399 { | 399 { |
400 ht->rehash_count = (size_t) | 400 ht->rehash_count = (size_t) |
401 ((double) ht->size * hash_table_rehash_threshold (ht)); | 401 ((double) ht->size * hash_table_rehash_threshold (ht)); |
402 ht->golden = (size_t) | 402 ht->golden_ratio = (size_t) |
403 ((double) ht->size * (.6180339887 / (double) sizeof (Lisp_Object))); | 403 ((double) ht->size * (.6180339887 / (double) sizeof (Lisp_Object))); |
404 } | 404 } |
405 | 405 |
406 Lisp_Object | 406 Lisp_Object |
407 make_general_lisp_hash_table (size_t size, | 407 make_general_lisp_hash_table (size_t size, |