Mercurial > hg > xemacs-beta
comparison src/xgccache.c @ 2515:de9952d2ed18
[xemacs-hg @ 2005-01-26 10:22:19 by ben]
Hash table cleanups, part 1 of 2
emacs-marshals.c, hash.c, hash.h, ui-gtk.c: Clean up and generalize creation of string hash tables.
ui-gtk.c, elhash.h, gccache-gtk.c, glyphs-gtk.c, lrecord.h, marker.c, objects-gtk.c, objects-msw.c, objects-tty.c, objects-x.c, objects.c, opaque.c, rangetab.c, specifier.c, specifier.h, xgccache.c: Use Hashcode rather than unsigned long.
author | ben |
---|---|
date | Wed, 26 Jan 2005 10:22:29 +0000 |
parents | 3d8143fc88e1 |
children |
comparison
equal
deleted
inserted
replaced
2514:b49d38bc659d | 2515:de9952d2ed18 |
---|---|
90 int create_count; | 90 int create_count; |
91 int delete_count; | 91 int delete_count; |
92 }; | 92 }; |
93 | 93 |
94 #ifdef GCCACHE_HASH | 94 #ifdef GCCACHE_HASH |
95 static unsigned long | 95 static Hashcode |
96 gc_cache_hash (const void *arg) | 96 gc_cache_hash (const void *arg) |
97 { | 97 { |
98 const struct gcv_and_mask *gcvm = (const struct gcv_and_mask *) arg; | 98 const struct gcv_and_mask *gcvm = (const struct gcv_and_mask *) arg; |
99 unsigned long *longs = (unsigned long *) &gcvm->gcv; | 99 unsigned long *longs = (unsigned long *) &gcvm->gcv; |
100 unsigned long hash = gcvm->mask; | 100 Hashcode hash = gcvm->mask; |
101 int i; | 101 int i; |
102 /* This could look at the mask and only use the used slots in the | 102 /* This could look at the mask and only use the used slots in the |
103 hash code. That would win in that we wouldn't have to initialize | 103 hash code. That would win in that we wouldn't have to initialize |
104 every slot of the gcv when calling gc_cache_lookup. But we need | 104 every slot of the gcv when calling gc_cache_lookup. But we need |
105 the hash function to be as fast as possible; some timings should | 105 the hash function to be as fast as possible; some timings should |
106 be done. */ | 106 be done. */ |
107 for (i = 0; i < (int) (sizeof (XGCValues) / sizeof (unsigned long)); i++) | 107 for (i = 0; i < (int) (sizeof (XGCValues) / sizeof (unsigned long)); i++) |
108 hash = (hash<<1) ^ *longs++; | 108 hash = (hash << 1) ^ *longs++; |
109 return hash; | 109 return hash; |
110 } | 110 } |
111 | 111 |
112 #endif /* GCCACHE_HASH */ | 112 #endif /* GCCACHE_HASH */ |
113 | 113 |