]> git.kaiwu.me - klib.git/commitdiff
change hash set to hash map
authorHeng Li <lh3@me.com>
Thu, 2 May 2013 20:25:50 +0000 (16:25 -0400)
committerHeng Li <lh3@me.com>
Thu, 2 May 2013 20:25:50 +0000 (16:25 -0400)
test/khash_test.c

index 3a4167067c153830018de5287ba6fa3c605e3b27..8d6687ff43912a6ad94730eb97908323324ccef5 100644 (file)
@@ -6,7 +6,7 @@
 
 #include "khash.h"
 KHASH_SET_INIT_STR(str)
-KHASH_SET_INIT_INT(int)
+KHASH_MAP_INIT_INT(int, unsigned char)
 
 typedef struct {
        unsigned key;
@@ -62,6 +62,7 @@ void ht_khash_int()
        h = kh_init(int);
        for (i = 0; i < data_size; ++i) {
                k = kh_put(int, h, data[i], &ret);
+               kh_val(h, k) = i&0xff;
                if (!ret) kh_del(int, h, k);
        }
        printf("[ht_khash_int] size: %u\n", kh_size(h));