diff options
| author | ksss <[email protected]> | 2014-04-03 11:26:37 +0000 |
|---|---|---|
| committer | ksss <[email protected]> | 2014-04-03 11:26:37 +0000 |
| commit | 169cf75b1ea04883633cc6275cdafc01ab71bec0 (patch) | |
| tree | 14914f93778782205f4c506abd512fc0260b25b6 /include | |
| parent | 697684654c9c3318e79a03c6293aac5dcaa84a92 (diff) | |
| download | mruby-169cf75b1ea04883633cc6275cdafc01ab71bec0.tar.gz mruby-169cf75b1ea04883633cc6275cdafc01ab71bec0.zip | |
delete khash member upper_bound
Diffstat (limited to 'include')
| -rw-r--r-- | include/mruby/khash.h | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/include/mruby/khash.h b/include/mruby/khash.h index 67418a996..5121f4708 100644 --- a/include/mruby/khash.h +++ b/include/mruby/khash.h @@ -46,6 +46,7 @@ static const uint8_t __m_either[] = {0x03, 0x0c, 0x30, 0xc0}; } while (0) #define khash_mask(h) ((h)->n_buckets-1) #define khash_inc(h) ((h)->n_buckets/2-1) +#define khash_upper_bound(h) (UPPER_BOUND((h)->n_buckets)) /* declare struct kh_xxx and kh_xxx_funcs @@ -59,7 +60,6 @@ static const uint8_t __m_either[] = {0x03, 0x0c, 0x30, 0xc0}; khint_t n_buckets; \ khint_t size; \ khint_t n_occupied; \ - khint_t upper_bound; \ uint8_t *ed_flags; \ khkey_t *keys; \ khval_t *vals; \ @@ -99,7 +99,6 @@ kh_fill_flags(uint8_t *p, uint8_t c, size_t len) size_t len = sizeof(khkey_t) + (kh_is_map ? sizeof(khval_t) : 0); \ uint8_t *p = (uint8_t*)mrb_malloc(mrb, sizeof(uint8_t)*sz/4+len*sz); \ h->size = h->n_occupied = 0; \ - h->upper_bound = UPPER_BOUND(sz); \ h->keys = (khkey_t *)p; \ h->vals = kh_is_map ? (khval_t *)(p+sizeof(khkey_t)*sz) : NULL; \ h->ed_flags = p+len*sz; \ @@ -170,7 +169,7 @@ kh_fill_flags(uint8_t *p, uint8_t c, size_t len) khint_t kh_put_##name(mrb_state *mrb, kh_##name##_t *h, khkey_t key) \ { \ khint_t k; \ - if (h->n_occupied >= h->upper_bound) { \ + if (h->n_occupied >= khash_upper_bound(h)) { \ kh_resize_##name(mrb, h, h->n_buckets*2); \ } \ k = __hash_func(mrb,key) & khash_mask(h); \ |
