Skip to content

Commit

Permalink
symbol table key should be mrb_sym, not int32_t
Browse files Browse the repository at this point in the history
  • Loading branch information
matz committed Jun 1, 2012
1 parent 8180fee commit 364e6b5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions include/mruby/khash.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -190,10 +190,9 @@ static const uint8_t __m[8] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80};
#define kh_size(h) ((h)->size) #define kh_size(h) ((h)->size)
#define kh_n_buckets(h) ((h)->n_buckets) #define kh_n_buckets(h) ((h)->n_buckets)


//#define kh_int_hash_func(mrb,key) (uint32_t)(key) #define kh_int_hash_func(mrb,key) (khint_t)((key)^((key)<<2)^((key)>>2))
#define kh_int_hash_func(mrb,key) (uint32_t)((key)^((key)<<2)^((key)>>2))
#define kh_int_hash_equal(mrb,a, b) (a == b) #define kh_int_hash_equal(mrb,a, b) (a == b)
#define kh_int64_hash_func(mrb,key) (uint32_t)((key)>>33^(key)^(key)<<11) #define kh_int64_hash_func(mrb,key) (khint_t)((key)>>33^(key)^(key)<<11)
#define kh_int64_hash_equal(mrb,a, b) (a == b) #define kh_int64_hash_equal(mrb,a, b) (a == b)
static inline khint_t __ac_X31_hash_string(const char *s) static inline khint_t __ac_X31_hash_string(const char *s)
{ {
Expand Down
2 changes: 1 addition & 1 deletion src/symbol.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <stdio.h> #include <stdio.h>


/* ------------------------------------------------------ */ /* ------------------------------------------------------ */
KHASH_MAP_INIT_INT(s2n, const char*); KHASH_INIT(s2n, mrb_sym, const char*, 1, kh_int_hash_func, kh_int_hash_equal)
KHASH_MAP_INIT_STR(n2s, mrb_sym); KHASH_MAP_INIT_STR(n2s, mrb_sym);
/* ------------------------------------------------------ */ /* ------------------------------------------------------ */
mrb_sym mrb_sym
Expand Down

0 comments on commit 364e6b5

Please sign in to comment.