NVBIO
|
Go to the source code of this file.
Macros | |
#define | AC_VERSION_KHASH_H "0.2.8" |
#define | kh_inline inline |
#define | __ac_isempty(flag, i) ((flag[i>>4]>>((i&0xfU)<<1))&2) |
#define | __ac_isdel(flag, i) ((flag[i>>4]>>((i&0xfU)<<1))&1) |
#define | __ac_iseither(flag, i) ((flag[i>>4]>>((i&0xfU)<<1))&3) |
#define | __ac_set_isdel_false(flag, i) (flag[i>>4]&=~(1ul<<((i&0xfU)<<1))) |
#define | __ac_set_isempty_false(flag, i) (flag[i>>4]&=~(2ul<<((i&0xfU)<<1))) |
#define | __ac_set_isboth_false(flag, i) (flag[i>>4]&=~(3ul<<((i&0xfU)<<1))) |
#define | __ac_set_isdel_true(flag, i) (flag[i>>4]|=1ul<<((i&0xfU)<<1)) |
#define | __ac_fsize(m) ((m) < 16? 1 : (m)>>4) |
#define | kroundup32(x) (--(x), (x)|=(x)>>1, (x)|=(x)>>2, (x)|=(x)>>4, (x)|=(x)>>8, (x)|=(x)>>16, ++(x)) |
#define | kcalloc(N, Z) calloc(N,Z) |
#define | kmalloc(Z) malloc(Z) |
#define | krealloc(P, Z) realloc(P,Z) |
#define | kfree(P) free(P) |
#define | __KHASH_TYPE(name, khkey_t, khval_t) |
#define | __KHASH_PROTOTYPES(name, khkey_t, khval_t) |
#define | __KHASH_IMPL(name, SCOPE, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal) |
#define | KHASH_DECLARE(name, khkey_t, khval_t) |
#define | KHASH_INIT2(name, SCOPE, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal) |
#define | KHASH_INIT(name, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal) KHASH_INIT2(name, static kh_inline, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal) |
#define | kh_int_hash_func(key) (khint32_t)(key) |
#define | kh_int_hash_equal(a, b) ((a) == (b)) |
#define | kh_int64_hash_func(key) (khint32_t)((key)>>33^(key)^(key)<<11) |
#define | kh_int64_hash_equal(a, b) ((a) == (b)) |
#define | kh_str_hash_func(key) __ac_X31_hash_string(key) |
#define | kh_str_hash_equal(a, b) (strcmp(a, b) == 0) |
#define | kh_int_hash_func2(k) __ac_Wang_hash((khint_t)key) |
#define | khash_t(name) kh_##name##_t |
#define | kh_init(name) kh_init_##name() |
#define | kh_destroy(name, h) kh_destroy_##name(h) |
#define | kh_clear(name, h) kh_clear_##name(h) |
#define | kh_resize(name, h, s) kh_resize_##name(h, s) |
#define | kh_put(name, h, k, r) kh_put_##name(h, k, r) |
#define | kh_get(name, h, k) kh_get_##name(h, k) |
#define | kh_del(name, h, k) kh_del_##name(h, k) |
#define | kh_exist(h, x) (!__ac_iseither((h)->flags, (x))) |
#define | kh_key(h, x) ((h)->keys[x]) |
#define | kh_val(h, x) ((h)->vals[x]) |
#define | kh_value(h, x) ((h)->vals[x]) |
#define | kh_begin(h) (khint_t)(0) |
#define | kh_end(h) ((h)->n_buckets) |
#define | kh_size(h) ((h)->size) |
#define | kh_n_buckets(h) ((h)->n_buckets) |
#define | kh_foreach(h, kvar, vvar, code) |
#define | kh_foreach_value(h, vvar, code) |
#define | KHASH_SET_INIT_INT(name) KHASH_INIT(name, khint32_t, char, 0, kh_int_hash_func, kh_int_hash_equal) |
#define | KHASH_MAP_INIT_INT(name, khval_t) KHASH_INIT(name, khint32_t, khval_t, 1, kh_int_hash_func, kh_int_hash_equal) |
#define | KHASH_SET_INIT_INT64(name) KHASH_INIT(name, khint64_t, char, 0, kh_int64_hash_func, kh_int64_hash_equal) |
#define | KHASH_MAP_INIT_INT64(name, khval_t) KHASH_INIT(name, khint64_t, khval_t, 1, kh_int64_hash_func, kh_int64_hash_equal) |
#define | KHASH_SET_INIT_STR(name) KHASH_INIT(name, kh_cstr_t, char, 0, kh_str_hash_func, kh_str_hash_equal) |
#define | KHASH_MAP_INIT_STR(name, khval_t) KHASH_INIT(name, kh_cstr_t, khval_t, 1, kh_str_hash_func, kh_str_hash_equal) |
Typedefs | |
typedef unsigned long | khint64_t |
typedef khint32_t | khint_t |
typedef khint_t | khiter_t |
typedef const char * | kh_cstr_t |
#define __ac_isdel | ( | flag, | |
i | |||
) | ((flag[i>>4]>>((i&0xfU)<<1))&1) |
#define __ac_iseither | ( | flag, | |
i | |||
) | ((flag[i>>4]>>((i&0xfU)<<1))&3) |
#define __ac_isempty | ( | flag, | |
i | |||
) | ((flag[i>>4]>>((i&0xfU)<<1))&2) |
#define __ac_set_isboth_false | ( | flag, | |
i | |||
) | (flag[i>>4]&=~(3ul<<((i&0xfU)<<1))) |
#define __ac_set_isdel_false | ( | flag, | |
i | |||
) | (flag[i>>4]&=~(1ul<<((i&0xfU)<<1))) |
#define __ac_set_isdel_true | ( | flag, | |
i | |||
) | (flag[i>>4]|=1ul<<((i&0xfU)<<1)) |
#define __ac_set_isempty_false | ( | flag, | |
i | |||
) | (flag[i>>4]&=~(2ul<<((i&0xfU)<<1))) |
#define __KHASH_IMPL | ( | name, | |
SCOPE, | |||
khkey_t, | |||
khval_t, | |||
kh_is_map, | |||
__hash_func, | |||
__hash_equal | |||
) |
#define __KHASH_PROTOTYPES | ( | name, | |
khkey_t, | |||
khval_t | |||
) |
#define __KHASH_TYPE | ( | name, | |
khkey_t, | |||
khval_t | |||
) |
#define AC_VERSION_KHASH_H "0.2.8" |
#define kh_begin | ( | h) | (khint_t)(0) |
Get the start iterator
h | Pointer to the hash table [khash_t(name)*] |
#define kh_clear | ( | name, | |
h | |||
) | kh_clear_##name(h) |
Reset a hash table without deallocating memory.
name | Name of the hash table [symbol] |
h | Pointer to the hash table [khash_t(name)*] |
#define kh_del | ( | name, | |
h, | |||
k | |||
) | kh_del_##name(h, k) |
Remove a key from the hash table.
name | Name of the hash table [symbol] |
h | Pointer to the hash table [khash_t(name)*] |
k | Iterator to the element to be deleted [khint_t] |
#define kh_destroy | ( | name, | |
h | |||
) | kh_destroy_##name(h) |
Destroy a hash table.
name | Name of the hash table [symbol] |
h | Pointer to the hash table [khash_t(name)*] |
#define kh_end | ( | h) | ((h)->n_buckets) |
Get the end iterator
h | Pointer to the hash table [khash_t(name)*] |
#define kh_exist | ( | h, | |
x | |||
) | (!__ac_iseither((h)->flags, (x))) |
Test whether a bucket contains data.
h | Pointer to the hash table [khash_t(name)*] |
x | Iterator to the bucket [khint_t] |
#define kh_foreach | ( | h, | |
kvar, | |||
vvar, | |||
code | |||
) |
Iterate over the entries in the hash table
h | Pointer to the hash table [khash_t(name)*] |
kvar | Variable to which key will be assigned |
vvar | Variable to which value will be assigned |
code | Block of code to execute |
#define kh_foreach_value | ( | h, | |
vvar, | |||
code | |||
) |
Iterate over the values in the hash table
h | Pointer to the hash table [khash_t(name)*] |
vvar | Variable to which value will be assigned |
code | Block of code to execute |
#define kh_get | ( | name, | |
h, | |||
k | |||
) | kh_get_##name(h, k) |
Retrieve a key from the hash table.
name | Name of the hash table [symbol] |
h | Pointer to the hash table [khash_t(name)*] |
k | Key [type of keys] |
#define kh_init | ( | name) | kh_init_##name() |
Initiate a hash table.
name | Name of the hash table [symbol] |
#define kh_int64_hash_equal | ( | a, | |
b | |||
) | ((a) == (b)) |
#define kh_int64_hash_func | ( | key) | (khint32_t)((key)>>33^(key)^(key)<<11) |
#define kh_int_hash_equal | ( | a, | |
b | |||
) | ((a) == (b)) |
#define kh_int_hash_func | ( | key) | (khint32_t)(key) |
#define kh_key | ( | h, | |
x | |||
) | ((h)->keys[x]) |
Get key given an iterator
h | Pointer to the hash table [khash_t(name)*] |
x | Iterator to the bucket [khint_t] |
#define kh_n_buckets | ( | h) | ((h)->n_buckets) |
Get the number of buckets in the hash table
h | Pointer to the hash table [khash_t(name)*] |
#define kh_put | ( | name, | |
h, | |||
k, | |||
r | |||
) | kh_put_##name(h, k, r) |
Insert a key to the hash table.
name | Name of the hash table [symbol] |
h | Pointer to the hash table [khash_t(name)*] |
k | Key [type of keys] |
r | Extra return code: -1 if the operation failed; 0 if the key is present in the hash table; 1 if the bucket is empty (never used); 2 if the element in the bucket has been deleted [int*] |
#define kh_resize | ( | name, | |
h, | |||
s | |||
) | kh_resize_##name(h, s) |
Resize a hash table.
name | Name of the hash table [symbol] |
h | Pointer to the hash table [khash_t(name)*] |
s | New size [khint_t] |
#define kh_size | ( | h) | ((h)->size) |
Get the number of elements in the hash table
h | Pointer to the hash table [khash_t(name)*] |
#define kh_str_hash_equal | ( | a, | |
b | |||
) | (strcmp(a, b) == 0) |
#define kh_str_hash_func | ( | key) | __ac_X31_hash_string(key) |
#define kh_val | ( | h, | |
x | |||
) | ((h)->vals[x]) |
Get value given an iterator
h | Pointer to the hash table [khash_t(name)*] |
x | Iterator to the bucket [khint_t] |
#define KHASH_DECLARE | ( | name, | |
khkey_t, | |||
khval_t | |||
) |
#define KHASH_INIT | ( | name, | |
khkey_t, | |||
khval_t, | |||
kh_is_map, | |||
__hash_func, | |||
__hash_equal | |||
) | KHASH_INIT2(name, static kh_inline, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal) |
#define KHASH_INIT2 | ( | name, | |
SCOPE, | |||
khkey_t, | |||
khval_t, | |||
kh_is_map, | |||
__hash_func, | |||
__hash_equal | |||
) |
#define KHASH_MAP_INIT_INT | ( | name, | |
khval_t | |||
) | KHASH_INIT(name, khint32_t, khval_t, 1, kh_int_hash_func, kh_int_hash_equal) |
#define KHASH_MAP_INIT_INT64 | ( | name, | |
khval_t | |||
) | KHASH_INIT(name, khint64_t, khval_t, 1, kh_int64_hash_func, kh_int64_hash_equal) |
#define KHASH_MAP_INIT_STR | ( | name, | |
khval_t | |||
) | KHASH_INIT(name, kh_cstr_t, khval_t, 1, kh_str_hash_func, kh_str_hash_equal) |
#define KHASH_SET_INIT_INT | ( | name) | KHASH_INIT(name, khint32_t, char, 0, kh_int_hash_func, kh_int_hash_equal) |
#define KHASH_SET_INIT_INT64 | ( | name) | KHASH_INIT(name, khint64_t, char, 0, kh_int64_hash_func, kh_int64_hash_equal) |
#define KHASH_SET_INIT_STR | ( | name) | KHASH_INIT(name, kh_cstr_t, char, 0, kh_str_hash_func, kh_str_hash_equal) |
#define khash_t | ( | name) | kh_##name##_t |
#define kroundup32 | ( | x) | (--(x), (x)|=(x)>>1, (x)|=(x)>>2, (x)|=(x)>>4, (x)|=(x)>>8, (x)|=(x)>>16, ++(x)) |