1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@13299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2007-08-29 02:36:54 +00:00
parent 3783246a2e
commit 167358d000
3 changed files with 173 additions and 1 deletions

View file

@ -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;