diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-01-17 01:54:50 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-01-17 01:54:50 +0000 |
commit | 270ac46a7c93019e13a51f3410c4a54782a8135f (patch) | |
tree | 4bd9b314bc33d920ddc51dd8321c7f9a6f585609 | |
parent | 07b9002d4cfda2436406b49344952c3a15037e41 (diff) | |
download | ruby-270ac46a7c93019e13a51f3410c4a54782a8135f.tar.gz |
* st.c (do_hash): it's the time to remove cast to unsigned int.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | st.c | 9 |
2 files changed, 8 insertions, 5 deletions
@@ -1,3 +1,7 @@ +Tue Jan 17 10:54:46 2012 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * st.c (do_hash): it's the time to remove cast to unsigned int. + Tue Jan 17 07:30:12 2012 NARUSE, Yui <naruse@ruby-lang.org> * st.c (unpack_entries): Fix r34310: on unpacking, the position of @@ -72,8 +72,7 @@ static void rehash(st_table *); #define EQUAL(table,x,y) ((x)==(y) || (*(table)->type->compare)((x),(y)) == 0) -/* remove cast to unsigned int in the future */ -#define do_hash(key,table) (unsigned int)(st_index_t)(*(table)->type->hash)((key)) +#define do_hash(key,table) (st_index_t)(*(table)->type->hash)((key)) #define do_hash_bin(key,table) (do_hash((key), (table))%(table)->num_bins) /* preparation for possible allocation improvements */ @@ -462,9 +461,9 @@ unpack_entries(register st_table *table) tmp_table.num_entries = 0; memset(tmp_table.bins, 0, sizeof(struct st_table_entry *) * tmp_table.num_bins); for (i = 0; i < table->num_entries; i++) { - st_index_t hash_val = do_hash(PKEY(table, i), &tmp_table); - add_direct(&tmp_table, PKEY(table, i), PVAL(table, i), - hash_val, hash_val % tmp_table.num_bins); + /* packed table should be numhash */ + st_index_t key = PKEY(table, i), value = PVAL(table, i); + add_direct(&tmp_table, key, value, key, key % tmp_table.num_bins); } *table = tmp_table; } |