diff options
| author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-08-29 02:36:54 +0000 |
|---|---|---|
| committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-08-29 02:36:54 +0000 |
| commit | 8554cd4a351093222293f33b3fa1e276556499ab (patch) | |
| tree | 7854aa9ab7893ec8ea578058c63a104f4094c6fa /include/ruby/st.h | |
| parent | f7509a263c498ad9c10e22250e711c2384d4afd4 (diff) | |
| download | ruby-8554cd4a351093222293f33b3fa1e276556499ab.tar.gz ruby-8554cd4a351093222293f33b3fa1e276556499ab.tar.xz ruby-8554cd4a351093222293f33b3fa1e276556499ab.zip | |
* include/ruby/st.h (struct st_table): add entries_packed 1-bit
bitfield. decrease num_bins 1-bit.
* st.c: pack numhash which have 5 or less entries in bins.
(st_init_table_with_size): setup entries_packed flag.
(st_clear): support packed mode.
(st_lookup): ditto.
(st_insert): ditto.
(st_add_direct): ditto.
(st_copy): ditto.
(st_delete): ditto.
(st_foreach): ditto.
(st_reverse_foreach): ditto.
(unpack_entries): new function for converting to unpacked mode.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@13299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'include/ruby/st.h')
| -rw-r--r-- | include/ruby/st.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/ruby/st.h b/include/ruby/st.h index 12dbd2c50..728159121 100644 --- a/include/ruby/st.h +++ b/include/ruby/st.h @@ -31,7 +31,8 @@ struct st_hash_type { struct st_table { const struct st_hash_type *type; - int num_bins; + unsigned int entries_packed : 1; + int num_bins : sizeof(int) * 8 - 1; int num_entries; struct st_table_entry **bins; struct st_table_entry *head; |
