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
c808f647
Commit
c808f647
authored
Jul 30, 2012
by
Yukihiro Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow specifying khash initial size
parent
c6f62104
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
include/mruby/khash.h
include/mruby/khash.h
+6
-3
No files found.
include/mruby/khash.h
View file @
c808f647
...
...
@@ -17,7 +17,7 @@ extern "C" {
typedef
uint32_t
khint_t
;
typedef
khint_t
khiter_t
;
#if
!defined(MRB_INITIAL_HASH_SIZE)
#if
ndef MRB_INITIAL_HASH_SIZE
# define MRB_INITIAL_HASH_SIZE 32
#endif
...
...
@@ -89,13 +89,16 @@ static const uint8_t __m[8] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80};
h->mask = sz-1; \
h->inc = sz/2-1; \
} \
kh_##name##_t *kh_init_##name
(mrb_state *mrb){
\
kh_##name##_t *kh_init_##name
##_size(mrb_state *mrb, khint_t size) {
\
kh_##name##_t *h = (kh_##name##_t*)mrb_calloc(mrb, 1, sizeof(kh_##name##_t)); \
h->n_buckets =
MRB_INITIAL_HASH_SIZE;
\
h->n_buckets =
size;
\
h->mrb = mrb; \
kh_alloc_##name(h); \
return h; \
} \
kh_##name##_t *kh_init_##name(mrb_state *mrb){ \
return kh_init_##name##_size(mrb, MRB_INITIAL_HASH_SIZE); \
} \
void kh_destroy_##name(kh_##name##_t *h) \
{ \
if( 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