Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
6b6f8937
Commit
6b6f8937
authored
Apr 03, 2014
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1998 from ksss/khash-delete-upper_bound
delete khash member upper_bound
parents
69768465
169cf75b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
3 deletions
+2
-3
include/mruby/khash.h
include/mruby/khash.h
+2
-3
No files found.
include/mruby/khash.h
View file @
6b6f8937
...
...
@@ -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); \
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment