/home/liu/actions-runner/_work/ccv/ccv/lib/3rdparty/khash/khash.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* The MIT License |
2 | | |
3 | | Copyright (c) 2008, 2009, 2011 by Attractive Chaos <attractor@live.co.uk> |
4 | | |
5 | | Permission is hereby granted, free of charge, to any person obtaining |
6 | | a copy of this software and associated documentation files (the |
7 | | "Software"), to deal in the Software without restriction, including |
8 | | without limitation the rights to use, copy, modify, merge, publish, |
9 | | distribute, sublicense, and/or sell copies of the Software, and to |
10 | | permit persons to whom the Software is furnished to do so, subject to |
11 | | the following conditions: |
12 | | |
13 | | The above copyright notice and this permission notice shall be |
14 | | included in all copies or substantial portions of the Software. |
15 | | |
16 | | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
17 | | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
18 | | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
19 | | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
20 | | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
21 | | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
22 | | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
23 | | SOFTWARE. |
24 | | */ |
25 | | |
26 | | /* |
27 | | An example: |
28 | | |
29 | | #include "khash.h" |
30 | | KHASH_MAP_INIT_INT(32, char) |
31 | | int main() { |
32 | | int ret, is_missing; |
33 | | khiter_t k; |
34 | | khash_t(32) *h = kh_init(32); |
35 | | k = kh_put(32, h, 5, &ret); |
36 | | kh_value(h, k) = 10; |
37 | | k = kh_get(32, h, 10); |
38 | | is_missing = (k == kh_end(h)); |
39 | | k = kh_get(32, h, 5); |
40 | | kh_del(32, h, k); |
41 | | for (k = kh_begin(h); k != kh_end(h); ++k) |
42 | | if (kh_exist(h, k)) kh_value(h, k) = 1; |
43 | | kh_destroy(32, h); |
44 | | return 0; |
45 | | } |
46 | | */ |
47 | | |
48 | | /* |
49 | | 2013-05-02 (0.2.8): |
50 | | |
51 | | * Use quadratic probing. When the capacity is power of 2, stepping function |
52 | | i*(i+1)/2 guarantees to traverse each bucket. It is better than double |
53 | | hashing on cache performance and is more robust than linear probing. |
54 | | |
55 | | In theory, double hashing should be more robust than quadratic probing. |
56 | | However, my implementation is probably not for large hash tables, because |
57 | | the second hash function is closely tied to the first hash function, |
58 | | which reduce the effectiveness of double hashing. |
59 | | |
60 | | Reference: http://research.cs.vt.edu/AVresearch/hashing/quadratic.php |
61 | | |
62 | | 2011-12-29 (0.2.7): |
63 | | |
64 | | * Minor code clean up; no actual effect. |
65 | | |
66 | | 2011-09-16 (0.2.6): |
67 | | |
68 | | * The capacity is a power of 2. This seems to dramatically improve the |
69 | | speed for simple keys. Thank Zilong Tan for the suggestion. Reference: |
70 | | |
71 | | - http://code.google.com/p/ulib/ |
72 | | - http://nothings.org/computer/judy/ |
73 | | |
74 | | * Allow to optionally use linear probing which usually has better |
75 | | performance for random input. Double hashing is still the default as it |
76 | | is more robust to certain non-random input. |
77 | | |
78 | | * Added Wang's integer hash function (not used by default). This hash |
79 | | function is more robust to certain non-random input. |
80 | | |
81 | | 2011-02-14 (0.2.5): |
82 | | |
83 | | * Allow to declare global functions. |
84 | | |
85 | | 2009-09-26 (0.2.4): |
86 | | |
87 | | * Improve portability |
88 | | |
89 | | 2008-09-19 (0.2.3): |
90 | | |
91 | | * Corrected the example |
92 | | * Improved interfaces |
93 | | |
94 | | 2008-09-11 (0.2.2): |
95 | | |
96 | | * Improved speed a little in kh_put() |
97 | | |
98 | | 2008-09-10 (0.2.1): |
99 | | |
100 | | * Added kh_clear() |
101 | | * Fixed a compiling error |
102 | | |
103 | | 2008-09-02 (0.2.0): |
104 | | |
105 | | * Changed to token concatenation which increases flexibility. |
106 | | |
107 | | 2008-08-31 (0.1.2): |
108 | | |
109 | | * Fixed a bug in kh_get(), which has not been tested previously. |
110 | | |
111 | | 2008-08-31 (0.1.1): |
112 | | |
113 | | * Added destructor |
114 | | */ |
115 | | |
116 | | |
117 | | #ifndef __AC_KHASH_H |
118 | | #define __AC_KHASH_H |
119 | | |
120 | | /*! |
121 | | @header |
122 | | |
123 | | Generic hash table library. |
124 | | */ |
125 | | |
126 | | #define AC_VERSION_KHASH_H "0.2.8" |
127 | | |
128 | | #include <stdlib.h> |
129 | | #include <string.h> |
130 | | #include <limits.h> |
131 | | |
132 | | /* compiler specific configuration */ |
133 | | |
134 | | #if UINT_MAX == 0xffffffffu |
135 | | typedef unsigned int khint32_t; |
136 | | #elif ULONG_MAX == 0xffffffffu |
137 | | typedef unsigned long khint32_t; |
138 | | #endif |
139 | | |
140 | | #if ULONG_MAX == ULLONG_MAX |
141 | | typedef unsigned long khint64_t; |
142 | | #else |
143 | | typedef unsigned long long khint64_t; |
144 | | #endif |
145 | | |
146 | | #ifndef kh_inline |
147 | | #ifdef _MSC_VER |
148 | | #define kh_inline __inline |
149 | | #else |
150 | | #define kh_inline inline |
151 | | #endif |
152 | | #endif /* kh_inline */ |
153 | | |
154 | | #ifndef klib_unused |
155 | | #if (defined __clang__ && __clang_major__ >= 3) || (defined __GNUC__ && __GNUC__ >= 3) |
156 | | #define klib_unused __attribute__ ((__unused__)) |
157 | | #else |
158 | | #define klib_unused |
159 | | #endif |
160 | | #endif /* klib_unused */ |
161 | | |
162 | | typedef khint32_t khint_t; |
163 | | typedef khint_t khiter_t; |
164 | | |
165 | 11.6M | #define __ac_isempty(flag, i) ((flag[i>>4]>>((i&0xfU)<<1))&2) |
166 | 10.1M | #define __ac_isdel(flag, i) ((flag[i>>4]>>((i&0xfU)<<1))&1) |
167 | 3.54M | #define __ac_iseither(flag, i) ((flag[i>>4]>>((i&0xfU)<<1))&3) |
168 | | #define __ac_set_isdel_false(flag, i) (flag[i>>4]&=~(1ul<<((i&0xfU)<<1))) |
169 | 303k | #define __ac_set_isempty_false(flag, i) (flag[i>>4]&=~(2ul<<((i&0xfU)<<1))) |
170 | 274k | #define __ac_set_isboth_false(flag, i) (flag[i>>4]&=~(3ul<<((i&0xfU)<<1))) |
171 | 304k | #define __ac_set_isdel_true(flag, i) (flag[i>>4]|=1ul<<((i&0xfU)<<1)) |
172 | | |
173 | 3.71k | #define __ac_fsize(m) ((m) < 16? 13.63k : (m)>>477 ) |
174 | | |
175 | | #ifndef kroundup32 |
176 | 3.71k | #define kroundup32(x) (--(x), (x)|=(x)>>1, (x)|=(x)>>2, (x)|=(x)>>4, (x)|=(x)>>8, (x)|=(x)>>16, ++(x)) |
177 | | #endif |
178 | | |
179 | | #ifndef kcalloc |
180 | 10.9k | #define kcalloc(N,Z) calloc(N,Z) |
181 | | #endif |
182 | | #ifndef kmalloc |
183 | 7.42k | #define kmalloc(Z) malloc(3.71k Z) |
184 | | #endif |
185 | | #ifndef krealloc |
186 | 7.21k | #define krealloc(P,Z) realloc(P,Z) |
187 | | #endif |
188 | | #ifndef kfree |
189 | 47.4k | #define kfree(P) free(P) |
190 | | #endif |
191 | | |
192 | | static const double __ac_HASH_UPPER = 0.77; |
193 | | |
194 | | #define __KHASH_TYPE(name, khkey_t, khval_t) \ |
195 | | typedef struct kh_##name##_s { \ |
196 | | khint_t n_buckets, size, n_occupied, upper_bound; \ |
197 | | khint32_t *flags; \ |
198 | | khkey_t *keys; \ |
199 | | khval_t *vals; \ |
200 | | } kh_##name##_t; |
201 | | |
202 | | #define __KHASH_PROTOTYPES(name, khkey_t, khval_t) \ |
203 | | extern kh_##name##_t *kh_init_##name(void); \ |
204 | | extern void kh_destroy_##name(kh_##name##_t *h); \ |
205 | | extern void kh_clear_##name(kh_##name##_t *h); \ |
206 | | extern khint_t kh_get_##name(const kh_##name##_t *h, khkey_t key); \ |
207 | | extern int kh_resize_##name(kh_##name##_t *h, khint_t new_n_buckets); \ |
208 | | extern khint_t kh_put_##name(kh_##name##_t *h, khkey_t key, int *ret); \ |
209 | | extern void kh_del_##name(kh_##name##_t *h, khint_t x); |
210 | | |
211 | | #define __KHASH_IMPL(name, SCOPE, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal) \ |
212 | 10.9k | SCOPE kh_##name##_t *kh_init_##name(void) { \ |
213 | 10.9k | return (kh_##name##_t*)kcalloc(1, sizeof(kh_##name##_t)); \ |
214 | 10.9k | } \ Unexecuted instantiation: while.backward.tests.c:kh_init_stream_map Unexecuted instantiation: tape.tests.c:kh_init_stream_map imdb.tests.c:kh_init_vocab_map Line | Count | Source | 212 | 3 | SCOPE kh_##name##_t *kh_init_##name(void) { \ | 213 | 3 | return (kh_##name##_t*)kcalloc(1, sizeof(kh_##name##_t)); \ | 214 | 3 | } \ |
Unexecuted instantiation: ccv_nnc_cmd.c:kh_init_stream_map Unexecuted instantiation: ccv_nnc_tensor.c:kh_init_stream_map Unexecuted instantiation: ccv_nnc_tensor_io.c:kh_init_stream_map Unexecuted instantiation: ccv_nnc_stream.c:kh_init_stream_map ccv_nnc_micro.c:kh_init_ccv_nnc_ids Line | Count | Source | 212 | 3 | SCOPE kh_##name##_t *kh_init_##name(void) { \ | 213 | 3 | return (kh_##name##_t*)kcalloc(1, sizeof(kh_##name##_t)); \ | 214 | 3 | } \ |
ccv_nnc_micro.c:kh_init_ccv_nnc_micro_bind_scalar Line | Count | Source | 212 | 3 | SCOPE kh_##name##_t *kh_init_##name(void) { \ | 213 | 3 | return (kh_##name##_t*)kcalloc(1, sizeof(kh_##name##_t)); \ | 214 | 3 | } \ |
ccv_nnc_micro_simplify.c:kh_init_ccv_nnc_axis_id_group Line | Count | Source | 212 | 6 | SCOPE kh_##name##_t *kh_init_##name(void) { \ | 213 | 6 | return (kh_##name##_t*)kcalloc(1, sizeof(kh_##name##_t)); \ | 214 | 6 | } \ |
Unexecuted instantiation: ccv_nnc_graph.c:kh_init_stream_map Unexecuted instantiation: ccv_nnc_symbolic_graph_io.c:kh_init_stream_map Unexecuted instantiation: ccv_nnc_symbolic_graph_compile.c:kh_init_stream_map Unexecuted instantiation: ccv_nnc_symbolic_graph_compile.c:kh_init_obj_ptr Unexecuted instantiation: ccv_nnc_graph_while.c:kh_init_stream_map Unexecuted instantiation: ccv_nnc_tensor_tape.c:kh_init_stream_map Unexecuted instantiation: ccv_nnc_graph_case_of.c:kh_init_stream_map Unexecuted instantiation: ccv_nnc_graph_run.c:kh_init_stream_map ccv_nnc_xpu_alloc.c:kh_init_dy_dev Line | Count | Source | 212 | 19 | SCOPE kh_##name##_t *kh_init_##name(void) { \ | 213 | 19 | return (kh_##name##_t*)kcalloc(1, sizeof(kh_##name##_t)); \ | 214 | 19 | } \ |
Unexecuted instantiation: ccv_nnc_xpu_alloc.c:kh_init_stream_map Unexecuted instantiation: ccv_nnc_xpu_alloc.c:kh_init_dy_str Unexecuted instantiation: ccv_nnc_xpu_alloc.c:kh_init_dy_alloc ccv_nnc_dynamic_graph.c:kh_init_dy_str Line | Count | Source | 212 | 53 | SCOPE kh_##name##_t *kh_init_##name(void) { \ | 213 | 53 | return (kh_##name##_t*)kcalloc(1, sizeof(kh_##name##_t)); \ | 214 | 53 | } \ |
ccv_nnc_dynamic_graph.c:kh_init_dy_alloc Line | Count | Source | 212 | 53 | SCOPE kh_##name##_t *kh_init_##name(void) { \ | 213 | 53 | return (kh_##name##_t*)kcalloc(1, sizeof(kh_##name##_t)); \ | 214 | 53 | } \ |
ccv_nnc_dynamic_graph.c:kh_init_stream_map Line | Count | Source | 212 | 10 | SCOPE kh_##name##_t *kh_init_##name(void) { \ | 213 | 10 | return (kh_##name##_t*)kcalloc(1, sizeof(kh_##name##_t)); \ | 214 | 10 | } \ |
Unexecuted instantiation: ccv_nnc_dynamic_graph.c:kh_init_dy_dev Unexecuted instantiation: ccv_nnc_dynamic_graph.c:kh_init_stateful_exec Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:kh_init_stream_map Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:kh_init_dy_dev Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:kh_init_dy_str Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:kh_init_dy_alloc Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:kh_init_stateful_exec Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:kh_init_stream_map Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:kh_init_dy_dev Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:kh_init_dy_str Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:kh_init_dy_alloc Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:kh_init_stateful_exec Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:kh_init_stream_map Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:kh_init_dy_dev Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:kh_init_dy_str Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:kh_init_dy_alloc Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:kh_init_stateful_exec Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:kh_init_stream_map Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:kh_init_dy_dev Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:kh_init_dy_str Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:kh_init_dy_alloc Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:kh_init_stateful_exec Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:kh_init_stream_map Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:kh_init_dy_dev Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:kh_init_dy_str Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:kh_init_dy_alloc Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:kh_init_stateful_exec Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:kh_init_ccv_cnnp_model_name_bank ccv_cnnp_dataframe.c:kh_init_ctx Line | Count | Source | 212 | 56 | SCOPE kh_##name##_t *kh_init_##name(void) { \ | 213 | 56 | return (kh_##name##_t*)kcalloc(1, sizeof(kh_##name##_t)); \ | 214 | 56 | } \ |
ccv_cnnp_dataframe.c:kh_init_iter_ctx Line | Count | Source | 212 | 4 | SCOPE kh_##name##_t *kh_init_##name(void) { \ | 213 | 4 | return (kh_##name##_t*)kcalloc(1, sizeof(kh_##name##_t)); \ | 214 | 4 | } \ |
ccv_cnnp_model.c:kh_init_ccv_cnnp_model_name_bank Line | Count | Source | 212 | 3.53k | SCOPE kh_##name##_t *kh_init_##name(void) { \ | 213 | 3.53k | return (kh_##name##_t*)kcalloc(1, sizeof(kh_##name##_t)); \ | 214 | 3.53k | } \ |
ccv_cnnp_model.c:kh_init_dy_str Line | Count | Source | 212 | 2.29k | SCOPE kh_##name##_t *kh_init_##name(void) { \ | 213 | 2.29k | return (kh_##name##_t*)kcalloc(1, sizeof(kh_##name##_t)); \ | 214 | 2.29k | } \ |
ccv_cnnp_model.c:kh_init_dy_alloc Line | Count | Source | 212 | 2.29k | SCOPE kh_##name##_t *kh_init_##name(void) { \ | 213 | 2.29k | return (kh_##name##_t*)kcalloc(1, sizeof(kh_##name##_t)); \ | 214 | 2.29k | } \ |
ccv_cnnp_model.c:kh_init_ccv_cnnp_parameter_id Line | Count | Source | 212 | 1 | SCOPE kh_##name##_t *kh_init_##name(void) { \ | 213 | 1 | return (kh_##name##_t*)kcalloc(1, sizeof(kh_##name##_t)); \ | 214 | 1 | } \ |
ccv_cnnp_model.c:kh_init_stream_map Line | Count | Source | 212 | 4 | SCOPE kh_##name##_t *kh_init_##name(void) { \ | 213 | 4 | return (kh_##name##_t*)kcalloc(1, sizeof(kh_##name##_t)); \ | 214 | 4 | } \ |
Unexecuted instantiation: ccv_cnnp_model.c:kh_init_dy_dev Unexecuted instantiation: ccv_cnnp_model_io.c:kh_init_stream_map Unexecuted instantiation: ccv_cnnp_model_io.c:kh_init_dy_dev Unexecuted instantiation: ccv_cnnp_model_io.c:kh_init_dy_str Unexecuted instantiation: ccv_cnnp_model_io.c:kh_init_dy_alloc Unexecuted instantiation: ccv_cnnp_model_io.c:kh_init_ccv_cnnp_model_name_bank ccv_cnnp_model_core.c:kh_init_ccv_cnnp_model_name_bank Line | Count | Source | 212 | 1.48k | SCOPE kh_##name##_t *kh_init_##name(void) { \ | 213 | 1.48k | return (kh_##name##_t*)kcalloc(1, sizeof(kh_##name##_t)); \ | 214 | 1.48k | } \ |
ccv_cnnp_model_core.c:kh_init_model Line | Count | Source | 212 | 1.00k | SCOPE kh_##name##_t *kh_init_##name(void) { \ | 213 | 1.00k | return (kh_##name##_t*)kcalloc(1, sizeof(kh_##name##_t)); \ | 214 | 1.00k | } \ |
ccv_cnnp_model_core.c:kh_init_io_node Line | Count | Source | 212 | 98 | SCOPE kh_##name##_t *kh_init_##name(void) { \ | 213 | 98 | return (kh_##name##_t*)kcalloc(1, sizeof(kh_##name##_t)); \ | 214 | 98 | } \ |
ccv_cnnp_model_core.c:kh_init_model_io Line | Count | Source | 212 | 8 | SCOPE kh_##name##_t *kh_init_##name(void) { \ | 213 | 8 | return (kh_##name##_t*)kcalloc(1, sizeof(kh_##name##_t)); \ | 214 | 8 | } \ |
Unexecuted instantiation: ccv_cnnp_model_core.c:kh_init_stream_map Unexecuted instantiation: ccv_cnnp_model_core.c:kh_init_dy_dev Unexecuted instantiation: ccv_cnnp_model_core.c:kh_init_dy_str Unexecuted instantiation: ccv_cnnp_model_core.c:kh_init_dy_alloc Unexecuted instantiation: ccv_cnnp_model_addons.c:kh_init_stream_map Unexecuted instantiation: ccv_cnnp_model_addons.c:kh_init_dy_dev Unexecuted instantiation: ccv_cnnp_model_addons.c:kh_init_dy_str Unexecuted instantiation: ccv_cnnp_model_addons.c:kh_init_dy_alloc Unexecuted instantiation: ccv_cnnp_model_addons.c:kh_init_ccv_cnnp_model_name_bank Unexecuted instantiation: ccv_nnc_palettize.c:kh_init_stream_map ccv_cnnp_model_gradient_checkpointing.c:kh_init_ccv_cnnp_model_name_bank Line | Count | Source | 212 | 2 | SCOPE kh_##name##_t *kh_init_##name(void) { \ | 213 | 2 | return (kh_##name##_t*)kcalloc(1, sizeof(kh_##name##_t)); \ | 214 | 2 | } \ |
ccv_cnnp_model_gradient_checkpointing.c:kh_init_ccv_cnnp_tensor_symbol_map Line | Count | Source | 212 | 2 | SCOPE kh_##name##_t *kh_init_##name(void) { \ | 213 | 2 | return (kh_##name##_t*)kcalloc(1, sizeof(kh_##name##_t)); \ | 214 | 2 | } \ |
Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:kh_init_stream_map Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:kh_init_dy_dev Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:kh_init_dy_str Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:kh_init_dy_alloc |
215 | | SCOPE void kh_destroy_##name(kh_##name##_t *h) \ |
216 | 10.9k | { \ |
217 | 10.9k | if (h) { \ |
218 | 10.9k | kfree((void *)h->keys); kfree(h->flags); \ |
219 | 10.9k | kfree((void *)h->vals); \ |
220 | 10.9k | kfree(h); \ |
221 | 10.9k | } \ |
222 | 10.9k | } \ Unexecuted instantiation: while.backward.tests.c:kh_destroy_stream_map Unexecuted instantiation: tape.tests.c:kh_destroy_stream_map imdb.tests.c:kh_destroy_vocab_map Line | Count | Source | 216 | 3 | { \ | 217 | 3 | if (h) { \ | 218 | 3 | kfree((void *)h->keys); kfree(h->flags); \ | 219 | 3 | kfree((void *)h->vals); \ | 220 | 3 | kfree(h); \ | 221 | 3 | } \ | 222 | 3 | } \ |
Unexecuted instantiation: ccv_nnc_cmd.c:kh_destroy_stream_map Unexecuted instantiation: ccv_nnc_tensor.c:kh_destroy_stream_map Unexecuted instantiation: ccv_nnc_tensor_io.c:kh_destroy_stream_map Unexecuted instantiation: ccv_nnc_stream.c:kh_destroy_stream_map ccv_nnc_micro.c:kh_destroy_ccv_nnc_ids Line | Count | Source | 216 | 3 | { \ | 217 | 3 | if (h) { \ | 218 | 3 | kfree((void *)h->keys); kfree(h->flags); \ | 219 | 3 | kfree((void *)h->vals); \ | 220 | 3 | kfree(h); \ | 221 | 3 | } \ | 222 | 3 | } \ |
ccv_nnc_micro.c:kh_destroy_ccv_nnc_micro_bind_scalar Line | Count | Source | 216 | 3 | { \ | 217 | 3 | if (h) { \ | 218 | 3 | kfree((void *)h->keys); kfree(h->flags); \ | 219 | 3 | kfree((void *)h->vals); \ | 220 | 3 | kfree(h); \ | 221 | 3 | } \ | 222 | 3 | } \ |
ccv_nnc_micro_simplify.c:kh_destroy_ccv_nnc_axis_id_group Line | Count | Source | 216 | 6 | { \ | 217 | 6 | if (h) { \ | 218 | 6 | kfree((void *)h->keys); kfree(h->flags); \ | 219 | 6 | kfree((void *)h->vals); \ | 220 | 6 | kfree(h); \ | 221 | 6 | } \ | 222 | 6 | } \ |
Unexecuted instantiation: ccv_nnc_graph.c:kh_destroy_stream_map Unexecuted instantiation: ccv_nnc_symbolic_graph_io.c:kh_destroy_stream_map Unexecuted instantiation: ccv_nnc_symbolic_graph_compile.c:kh_destroy_stream_map Unexecuted instantiation: ccv_nnc_symbolic_graph_compile.c:kh_destroy_obj_ptr Unexecuted instantiation: ccv_nnc_graph_while.c:kh_destroy_stream_map Unexecuted instantiation: ccv_nnc_tensor_tape.c:kh_destroy_stream_map Unexecuted instantiation: ccv_nnc_graph_case_of.c:kh_destroy_stream_map Unexecuted instantiation: ccv_nnc_graph_run.c:kh_destroy_stream_map ccv_nnc_xpu_alloc.c:kh_destroy_dy_alloc Line | Count | Source | 216 | 2.34k | { \ | 217 | 2.34k | if (h) { \ | 218 | 2.34k | kfree((void *)h->keys); kfree(h->flags); \ | 219 | 2.34k | kfree((void *)h->vals); \ | 220 | 2.34k | kfree(h); \ | 221 | 2.34k | } \ | 222 | 2.34k | } \ |
ccv_nnc_xpu_alloc.c:kh_destroy_dy_dev Line | Count | Source | 216 | 19 | { \ | 217 | 19 | if (h) { \ | 218 | 19 | kfree((void *)h->keys); kfree(h->flags); \ | 219 | 19 | kfree((void *)h->vals); \ | 220 | 19 | kfree(h); \ | 221 | 19 | } \ | 222 | 19 | } \ |
ccv_nnc_xpu_alloc.c:kh_destroy_dy_str Line | Count | Source | 216 | 2.34k | { \ | 217 | 2.34k | if (h) { \ | 218 | 2.34k | kfree((void *)h->keys); kfree(h->flags); \ | 219 | 2.34k | kfree((void *)h->vals); \ | 220 | 2.34k | kfree(h); \ | 221 | 2.34k | } \ | 222 | 2.34k | } \ |
Unexecuted instantiation: ccv_nnc_xpu_alloc.c:kh_destroy_stream_map ccv_nnc_dynamic_graph.c:kh_destroy_stream_map Line | Count | Source | 216 | 10 | { \ | 217 | 10 | if (h) { \ | 218 | 10 | kfree((void *)h->keys); kfree(h->flags); \ | 219 | 10 | kfree((void *)h->vals); \ | 220 | 10 | kfree(h); \ | 221 | 10 | } \ | 222 | 10 | } \ |
Unexecuted instantiation: ccv_nnc_dynamic_graph.c:kh_destroy_dy_dev Unexecuted instantiation: ccv_nnc_dynamic_graph.c:kh_destroy_dy_str Unexecuted instantiation: ccv_nnc_dynamic_graph.c:kh_destroy_dy_alloc Unexecuted instantiation: ccv_nnc_dynamic_graph.c:kh_destroy_stateful_exec Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:kh_destroy_stream_map Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:kh_destroy_dy_dev Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:kh_destroy_dy_str Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:kh_destroy_dy_alloc Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:kh_destroy_stateful_exec Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:kh_destroy_stream_map Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:kh_destroy_dy_dev Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:kh_destroy_dy_str Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:kh_destroy_dy_alloc Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:kh_destroy_stateful_exec Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:kh_destroy_stream_map Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:kh_destroy_dy_dev Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:kh_destroy_dy_str Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:kh_destroy_dy_alloc Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:kh_destroy_stateful_exec Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:kh_destroy_stream_map Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:kh_destroy_dy_dev Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:kh_destroy_dy_str Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:kh_destroy_dy_alloc Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:kh_destroy_stateful_exec Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:kh_destroy_stream_map Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:kh_destroy_dy_dev Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:kh_destroy_dy_str Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:kh_destroy_dy_alloc Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:kh_destroy_stateful_exec Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:kh_destroy_ccv_cnnp_model_name_bank ccv_cnnp_dataframe.c:kh_destroy_iter_ctx Line | Count | Source | 216 | 4 | { \ | 217 | 4 | if (h) { \ | 218 | 4 | kfree((void *)h->keys); kfree(h->flags); \ | 219 | 4 | kfree((void *)h->vals); \ | 220 | 4 | kfree(h); \ | 221 | 4 | } \ | 222 | 4 | } \ |
ccv_cnnp_dataframe.c:kh_destroy_ctx Line | Count | Source | 216 | 56 | { \ | 217 | 56 | if (h) { \ | 218 | 56 | kfree((void *)h->keys); kfree(h->flags); \ | 219 | 56 | kfree((void *)h->vals); \ | 220 | 56 | kfree(h); \ | 221 | 56 | } \ | 222 | 56 | } \ |
ccv_cnnp_model.c:kh_destroy_ccv_cnnp_model_name_bank Line | Count | Source | 216 | 3.53k | { \ | 217 | 3.53k | if (h) { \ | 218 | 3.53k | kfree((void *)h->keys); kfree(h->flags); \ | 219 | 3.53k | kfree((void *)h->vals); \ | 220 | 3.53k | kfree(h); \ | 221 | 3.53k | } \ | 222 | 3.53k | } \ |
ccv_cnnp_model.c:kh_destroy_ccv_cnnp_parameter_id Line | Count | Source | 216 | 1 | { \ | 217 | 1 | if (h) { \ | 218 | 1 | kfree((void *)h->keys); kfree(h->flags); \ | 219 | 1 | kfree((void *)h->vals); \ | 220 | 1 | kfree(h); \ | 221 | 1 | } \ | 222 | 1 | } \ |
ccv_cnnp_model.c:kh_destroy_stream_map Line | Count | Source | 216 | 4 | { \ | 217 | 4 | if (h) { \ | 218 | 4 | kfree((void *)h->keys); kfree(h->flags); \ | 219 | 4 | kfree((void *)h->vals); \ | 220 | 4 | kfree(h); \ | 221 | 4 | } \ | 222 | 4 | } \ |
Unexecuted instantiation: ccv_cnnp_model.c:kh_destroy_dy_dev Unexecuted instantiation: ccv_cnnp_model.c:kh_destroy_dy_str Unexecuted instantiation: ccv_cnnp_model.c:kh_destroy_dy_alloc Unexecuted instantiation: ccv_cnnp_model_io.c:kh_destroy_stream_map Unexecuted instantiation: ccv_cnnp_model_io.c:kh_destroy_dy_dev Unexecuted instantiation: ccv_cnnp_model_io.c:kh_destroy_dy_str Unexecuted instantiation: ccv_cnnp_model_io.c:kh_destroy_dy_alloc Unexecuted instantiation: ccv_cnnp_model_io.c:kh_destroy_ccv_cnnp_model_name_bank ccv_cnnp_model_core.c:kh_destroy_ccv_cnnp_model_name_bank Line | Count | Source | 216 | 1.48k | { \ | 217 | 1.48k | if (h) { \ | 218 | 1.48k | kfree((void *)h->keys); kfree(h->flags); \ | 219 | 1.48k | kfree((void *)h->vals); \ | 220 | 1.48k | kfree(h); \ | 221 | 1.48k | } \ | 222 | 1.48k | } \ |
ccv_cnnp_model_core.c:kh_destroy_model Line | Count | Source | 216 | 1.00k | { \ | 217 | 1.00k | if (h) { \ | 218 | 1.00k | kfree((void *)h->keys); kfree(h->flags); \ | 219 | 1.00k | kfree((void *)h->vals); \ | 220 | 1.00k | kfree(h); \ | 221 | 1.00k | } \ | 222 | 1.00k | } \ |
ccv_cnnp_model_core.c:kh_destroy_io_node Line | Count | Source | 216 | 98 | { \ | 217 | 98 | if (h) { \ | 218 | 98 | kfree((void *)h->keys); kfree(h->flags); \ | 219 | 98 | kfree((void *)h->vals); \ | 220 | 98 | kfree(h); \ | 221 | 98 | } \ | 222 | 98 | } \ |
ccv_cnnp_model_core.c:kh_destroy_model_io Line | Count | Source | 216 | 8 | { \ | 217 | 8 | if (h) { \ | 218 | 8 | kfree((void *)h->keys); kfree(h->flags); \ | 219 | 8 | kfree((void *)h->vals); \ | 220 | 8 | kfree(h); \ | 221 | 8 | } \ | 222 | 8 | } \ |
Unexecuted instantiation: ccv_cnnp_model_core.c:kh_destroy_stream_map Unexecuted instantiation: ccv_cnnp_model_core.c:kh_destroy_dy_dev Unexecuted instantiation: ccv_cnnp_model_core.c:kh_destroy_dy_str Unexecuted instantiation: ccv_cnnp_model_core.c:kh_destroy_dy_alloc Unexecuted instantiation: ccv_cnnp_model_addons.c:kh_destroy_stream_map Unexecuted instantiation: ccv_cnnp_model_addons.c:kh_destroy_dy_dev Unexecuted instantiation: ccv_cnnp_model_addons.c:kh_destroy_dy_str Unexecuted instantiation: ccv_cnnp_model_addons.c:kh_destroy_dy_alloc Unexecuted instantiation: ccv_cnnp_model_addons.c:kh_destroy_ccv_cnnp_model_name_bank Unexecuted instantiation: ccv_nnc_palettize.c:kh_destroy_stream_map ccv_cnnp_model_gradient_checkpointing.c:kh_destroy_ccv_cnnp_model_name_bank Line | Count | Source | 216 | 2 | { \ | 217 | 2 | if (h) { \ | 218 | 2 | kfree((void *)h->keys); kfree(h->flags); \ | 219 | 2 | kfree((void *)h->vals); \ | 220 | 2 | kfree(h); \ | 221 | 2 | } \ | 222 | 2 | } \ |
ccv_cnnp_model_gradient_checkpointing.c:kh_destroy_ccv_cnnp_tensor_symbol_map Line | Count | Source | 216 | 2 | { \ | 217 | 2 | if (h) { \ | 218 | 2 | kfree((void *)h->keys); kfree(h->flags); \ | 219 | 2 | kfree((void *)h->vals); \ | 220 | 2 | kfree(h); \ | 221 | 2 | } \ | 222 | 2 | } \ |
Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:kh_destroy_stream_map Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:kh_destroy_dy_dev Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:kh_destroy_dy_str Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:kh_destroy_dy_alloc |
223 | | SCOPE void kh_clear_##name(kh_##name##_t *h) \ |
224 | 0 | { \ |
225 | 0 | if (h && h->flags) { \ |
226 | 0 | memset(h->flags, 0xaa, __ac_fsize(h->n_buckets) * sizeof(khint32_t)); \ |
227 | 0 | h->size = h->n_occupied = 0; \ |
228 | 0 | } \ |
229 | 0 | } \ Unexecuted instantiation: while.backward.tests.c:kh_clear_stream_map Unexecuted instantiation: tape.tests.c:kh_clear_stream_map Unexecuted instantiation: imdb.tests.c:kh_clear_vocab_map Unexecuted instantiation: ccv_nnc_cmd.c:kh_clear_stream_map Unexecuted instantiation: ccv_nnc_tensor.c:kh_clear_stream_map Unexecuted instantiation: ccv_nnc_tensor_io.c:kh_clear_stream_map Unexecuted instantiation: ccv_nnc_stream.c:kh_clear_stream_map Unexecuted instantiation: ccv_nnc_micro.c:kh_clear_ccv_nnc_micro_bind_scalar Unexecuted instantiation: ccv_nnc_micro.c:kh_clear_ccv_nnc_ids Unexecuted instantiation: ccv_nnc_micro_simplify.c:kh_clear_ccv_nnc_axis_id_group Unexecuted instantiation: ccv_nnc_graph.c:kh_clear_stream_map Unexecuted instantiation: ccv_nnc_symbolic_graph_io.c:kh_clear_stream_map Unexecuted instantiation: ccv_nnc_symbolic_graph_compile.c:kh_clear_stream_map Unexecuted instantiation: ccv_nnc_symbolic_graph_compile.c:kh_clear_obj_ptr Unexecuted instantiation: ccv_nnc_graph_while.c:kh_clear_stream_map Unexecuted instantiation: ccv_nnc_tensor_tape.c:kh_clear_stream_map Unexecuted instantiation: ccv_nnc_graph_case_of.c:kh_clear_stream_map Unexecuted instantiation: ccv_nnc_graph_run.c:kh_clear_stream_map Unexecuted instantiation: ccv_nnc_xpu_alloc.c:kh_clear_stream_map Unexecuted instantiation: ccv_nnc_xpu_alloc.c:kh_clear_dy_dev Unexecuted instantiation: ccv_nnc_xpu_alloc.c:kh_clear_dy_str Unexecuted instantiation: ccv_nnc_xpu_alloc.c:kh_clear_dy_alloc Unexecuted instantiation: ccv_nnc_dynamic_graph.c:kh_clear_stream_map Unexecuted instantiation: ccv_nnc_dynamic_graph.c:kh_clear_dy_dev Unexecuted instantiation: ccv_nnc_dynamic_graph.c:kh_clear_dy_str Unexecuted instantiation: ccv_nnc_dynamic_graph.c:kh_clear_dy_alloc Unexecuted instantiation: ccv_nnc_dynamic_graph.c:kh_clear_stateful_exec Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:kh_clear_stream_map Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:kh_clear_dy_dev Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:kh_clear_dy_str Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:kh_clear_dy_alloc Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:kh_clear_stateful_exec Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:kh_clear_stream_map Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:kh_clear_dy_dev Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:kh_clear_dy_str Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:kh_clear_dy_alloc Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:kh_clear_stateful_exec Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:kh_clear_stream_map Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:kh_clear_dy_dev Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:kh_clear_dy_str Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:kh_clear_dy_alloc Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:kh_clear_stateful_exec Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:kh_clear_stream_map Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:kh_clear_dy_dev Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:kh_clear_dy_str Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:kh_clear_dy_alloc Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:kh_clear_stateful_exec Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:kh_clear_stream_map Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:kh_clear_dy_dev Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:kh_clear_dy_str Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:kh_clear_dy_alloc Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:kh_clear_stateful_exec Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:kh_clear_ccv_cnnp_model_name_bank Unexecuted instantiation: ccv_cnnp_dataframe.c:kh_clear_ctx Unexecuted instantiation: ccv_cnnp_dataframe.c:kh_clear_iter_ctx Unexecuted instantiation: ccv_cnnp_model.c:kh_clear_stream_map Unexecuted instantiation: ccv_cnnp_model.c:kh_clear_dy_dev Unexecuted instantiation: ccv_cnnp_model.c:kh_clear_dy_str Unexecuted instantiation: ccv_cnnp_model.c:kh_clear_dy_alloc Unexecuted instantiation: ccv_cnnp_model.c:kh_clear_ccv_cnnp_model_name_bank Unexecuted instantiation: ccv_cnnp_model.c:kh_clear_ccv_cnnp_parameter_id Unexecuted instantiation: ccv_cnnp_model_io.c:kh_clear_stream_map Unexecuted instantiation: ccv_cnnp_model_io.c:kh_clear_dy_dev Unexecuted instantiation: ccv_cnnp_model_io.c:kh_clear_dy_str Unexecuted instantiation: ccv_cnnp_model_io.c:kh_clear_dy_alloc Unexecuted instantiation: ccv_cnnp_model_io.c:kh_clear_ccv_cnnp_model_name_bank Unexecuted instantiation: ccv_cnnp_model_core.c:kh_clear_stream_map Unexecuted instantiation: ccv_cnnp_model_core.c:kh_clear_dy_dev Unexecuted instantiation: ccv_cnnp_model_core.c:kh_clear_dy_str Unexecuted instantiation: ccv_cnnp_model_core.c:kh_clear_dy_alloc Unexecuted instantiation: ccv_cnnp_model_core.c:kh_clear_ccv_cnnp_model_name_bank Unexecuted instantiation: ccv_cnnp_model_core.c:kh_clear_model Unexecuted instantiation: ccv_cnnp_model_core.c:kh_clear_io_node Unexecuted instantiation: ccv_cnnp_model_core.c:kh_clear_model_io Unexecuted instantiation: ccv_cnnp_model_addons.c:kh_clear_stream_map Unexecuted instantiation: ccv_cnnp_model_addons.c:kh_clear_dy_dev Unexecuted instantiation: ccv_cnnp_model_addons.c:kh_clear_dy_str Unexecuted instantiation: ccv_cnnp_model_addons.c:kh_clear_dy_alloc Unexecuted instantiation: ccv_cnnp_model_addons.c:kh_clear_ccv_cnnp_model_name_bank Unexecuted instantiation: ccv_nnc_palettize.c:kh_clear_stream_map Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:kh_clear_stream_map Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:kh_clear_dy_dev Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:kh_clear_dy_str Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:kh_clear_dy_alloc Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:kh_clear_ccv_cnnp_model_name_bank Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:kh_clear_ccv_cnnp_tensor_symbol_map |
230 | | SCOPE khint_t kh_get_##name(const kh_##name##_t *h, khkey_t key) \ |
231 | 2.60M | { \ |
232 | 2.60M | if (h->n_buckets) { \ |
233 | 2.60M | khint_t k, i, last, mask, step = 0; \ |
234 | 2.60M | mask = h->n_buckets - 1; \ |
235 | 2.60M | k = __hash_func(key); i = k & mask; \ |
236 | 2.60M | last = i; \ |
237 | 3.82M | while (!__ac_isempty(h->flags, i) && (3.81M __ac_isdel3.81M (h->flags, i) || !3.81M __hash_equal3.81M (h->keys[i], key))) { \ |
238 | 1.22M | i = (i + (++step)) & mask; \ |
239 | 1.22M | if (i == last) return h->n_buckets0 ; \ |
240 | 1.22M | } \ |
241 | 2.60M | return __ac_iseither(h->flags, i)? h->n_buckets9.08k : i2.59M ; \ |
242 | 2.60M | } else return 0612 ; \ |
243 | 2.60M | } \ Unexecuted instantiation: while.backward.tests.c:kh_get_stream_map Unexecuted instantiation: tape.tests.c:kh_get_stream_map imdb.tests.c:kh_get_vocab_map Line | Count | Source | 231 | 184k | { \ | 232 | 184k | if (h->n_buckets) { \ | 233 | 184k | khint_t k, i, last, mask, step = 0; \ | 234 | 184k | mask = h->n_buckets - 1; \ | 235 | 184k | k = __hash_func(key); i = k & mask; \ | 236 | 184k | last = i; \ | 237 | 366k | while (!__ac_isempty(h->flags, i) && (358k __ac_isdel358k (h->flags, i) || !358k __hash_equal358k (h->keys[i], key))) { \ | 238 | 181k | i = (i + (++step)) & mask; \ | 239 | 181k | if (i == last) return h->n_buckets0 ; \ | 240 | 181k | } \ | 241 | 184k | return __ac_iseither(h->flags, i)? h->n_buckets8.10k : i176k ; \ | 242 | 184k | } else return 00 ; \ | 243 | 184k | } \ |
Unexecuted instantiation: ccv_nnc_cmd.c:kh_get_stream_map Unexecuted instantiation: ccv_nnc_tensor.c:kh_get_stream_map Unexecuted instantiation: ccv_nnc_tensor_io.c:kh_get_stream_map Unexecuted instantiation: ccv_nnc_stream.c:kh_get_stream_map ccv_nnc_micro.c:kh_get_ccv_nnc_micro_bind_scalar Line | Count | Source | 231 | 10 | { \ | 232 | 10 | if (h->n_buckets) { \ | 233 | 10 | khint_t k, i, last, mask, step = 0; \ | 234 | 10 | mask = h->n_buckets - 1; \ | 235 | 10 | k = __hash_func(key); i = k & mask; \ | 236 | 10 | last = i; \ | 237 | 14 | while (!__ac_isempty(h->flags, i) && (__ac_isdel(h->flags, i) || !__hash_equal(h->keys[i], key))) { \ | 238 | 4 | i = (i + (++step)) & mask; \ | 239 | 4 | if (i == last) return h->n_buckets0 ; \ | 240 | 4 | } \ | 241 | 10 | return __ac_iseither(h->flags, i)? h->n_buckets0 : i; \ | 242 | 10 | } else return 00 ; \ | 243 | 10 | } \ |
Unexecuted instantiation: ccv_nnc_micro.c:kh_get_ccv_nnc_ids ccv_nnc_micro_simplify.c:kh_get_ccv_nnc_axis_id_group Line | Count | Source | 231 | 1.38k | { \ | 232 | 1.38k | if (h->n_buckets) { \ | 233 | 923 | khint_t k, i, last, mask, step = 0; \ | 234 | 923 | mask = h->n_buckets - 1; \ | 235 | 923 | k = __hash_func(key); i = k & mask; \ | 236 | 923 | last = i; \ | 237 | 1.11k | while (!__ac_isempty(h->flags, i) && (244 __ac_isdel244 (h->flags, i) || !244 __hash_equal244 (h->keys[i], key))) { \ | 238 | 189 | i = (i + (++step)) & mask; \ | 239 | 189 | if (i == last) return h->n_buckets0 ; \ | 240 | 189 | } \ | 241 | 923 | return __ac_iseither(h->flags, i)? h->n_buckets868 : i55 ; \ | 242 | 923 | } else return 0466 ; \ | 243 | 1.38k | } \ |
Unexecuted instantiation: ccv_nnc_graph.c:kh_get_stream_map Unexecuted instantiation: ccv_nnc_symbolic_graph_io.c:kh_get_stream_map Unexecuted instantiation: ccv_nnc_symbolic_graph_compile.c:kh_get_stream_map Unexecuted instantiation: ccv_nnc_symbolic_graph_compile.c:kh_get_obj_ptr Unexecuted instantiation: ccv_nnc_graph_while.c:kh_get_stream_map Unexecuted instantiation: ccv_nnc_tensor_tape.c:kh_get_stream_map Unexecuted instantiation: ccv_nnc_graph_case_of.c:kh_get_stream_map Unexecuted instantiation: ccv_nnc_graph_run.c:kh_get_stream_map ccv_nnc_xpu_alloc.c:kh_get_dy_dev Line | Count | Source | 231 | 704 | { \ | 232 | 704 | if (h->n_buckets) { \ | 233 | 558 | khint_t k, i, last, mask, step = 0; \ | 234 | 558 | mask = h->n_buckets - 1; \ | 235 | 558 | k = __hash_func(key); i = k & mask; \ | 236 | 558 | last = i; \ | 237 | 558 | while (!__ac_isempty(h->flags, i) && (__ac_isdel(h->flags, i) || !__hash_equal(h->keys[i], key))) { \ | 238 | 0 | i = (i + (++step)) & mask; \ | 239 | 0 | if (i == last) return h->n_buckets; \ | 240 | 0 | } \ | 241 | 558 | return __ac_iseither(h->flags, i)? h->n_buckets0 : i; \ | 242 | 558 | } else return 0146 ; \ | 243 | 704 | } \ |
ccv_nnc_xpu_alloc.c:kh_get_dy_alloc Line | Count | Source | 231 | 723 | { \ | 232 | 723 | if (h->n_buckets) { \ | 233 | 723 | khint_t k, i, last, mask, step = 0; \ | 234 | 723 | mask = h->n_buckets - 1; \ | 235 | 723 | k = __hash_func(key); i = k & mask; \ | 236 | 723 | last = i; \ | 237 | 6.96k | while (!__ac_isempty(h->flags, i) && (__ac_isdel(h->flags, i) || !4.11k __hash_equal4.11k (h->keys[i], key))) { \ | 238 | 6.24k | i = (i + (++step)) & mask; \ | 239 | 6.24k | if (i == last) return h->n_buckets0 ; \ | 240 | 6.24k | } \ | 241 | 723 | return __ac_iseither(h->flags, i)? h->n_buckets0 : i; \ | 242 | 723 | } else return 00 ; \ | 243 | 723 | } \ |
ccv_nnc_xpu_alloc.c:kh_get_dy_str Line | Count | Source | 231 | 725 | { \ | 232 | 725 | if (h->n_buckets) { \ | 233 | 725 | khint_t k, i, last, mask, step = 0; \ | 234 | 725 | mask = h->n_buckets - 1; \ | 235 | 725 | k = __hash_func(key); i = k & mask; \ | 236 | 725 | last = i; \ | 237 | 1.17k | while (!__ac_isempty(h->flags, i) && (1.12k __ac_isdel1.12k (h->flags, i) || !1.07k __hash_equal1.07k (h->keys[i], key))) { \ | 238 | 450 | i = (i + (++step)) & mask; \ | 239 | 450 | if (i == last) return h->n_buckets0 ; \ | 240 | 450 | } \ | 241 | 725 | return __ac_iseither(h->flags, i)? h->n_buckets48 : i677 ; \ | 242 | 725 | } else return 00 ; \ | 243 | 725 | } \ |
Unexecuted instantiation: ccv_nnc_xpu_alloc.c:kh_get_stream_map Unexecuted instantiation: ccv_nnc_dynamic_graph.c:kh_get_stream_map Unexecuted instantiation: ccv_nnc_dynamic_graph.c:kh_get_dy_dev Unexecuted instantiation: ccv_nnc_dynamic_graph.c:kh_get_dy_str Unexecuted instantiation: ccv_nnc_dynamic_graph.c:kh_get_dy_alloc Unexecuted instantiation: ccv_nnc_dynamic_graph.c:kh_get_stateful_exec Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:kh_get_stream_map Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:kh_get_dy_dev Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:kh_get_dy_str Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:kh_get_dy_alloc Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:kh_get_stateful_exec Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:kh_get_stream_map Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:kh_get_dy_dev Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:kh_get_dy_str Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:kh_get_dy_alloc Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:kh_get_stateful_exec Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:kh_get_stream_map Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:kh_get_dy_dev Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:kh_get_dy_str Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:kh_get_dy_alloc Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:kh_get_stateful_exec Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:kh_get_stream_map Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:kh_get_dy_dev Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:kh_get_dy_str Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:kh_get_dy_alloc Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:kh_get_stateful_exec Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:kh_get_stream_map Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:kh_get_dy_dev Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:kh_get_dy_str Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:kh_get_dy_alloc Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:kh_get_stateful_exec Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:kh_get_ccv_cnnp_model_name_bank ccv_cnnp_dataframe.c:kh_get_ctx Line | Count | Source | 231 | 2.41M | { \ | 232 | 2.41M | if (h->n_buckets) { \ | 233 | 2.41M | khint_t k, i, last, mask, step = 0; \ | 234 | 2.41M | mask = h->n_buckets - 1; \ | 235 | 2.41M | k = __hash_func(key); i = k & mask; \ | 236 | 2.41M | last = i; \ | 237 | 3.45M | while (!__ac_isempty(h->flags, i) && (3.45M __ac_isdel3.45M (h->flags, i) || !3.45M __hash_equal3.45M (h->keys[i], key))) { \ | 238 | 1.03M | i = (i + (++step)) & mask; \ | 239 | 1.03M | if (i == last) return h->n_buckets0 ; \ | 240 | 1.03M | } \ | 241 | 2.41M | return __ac_iseither(h->flags, i)? h->n_buckets40 : i2.41M ; \ | 242 | 2.41M | } else return 00 ; \ | 243 | 2.41M | } \ |
Unexecuted instantiation: ccv_cnnp_dataframe.c:kh_get_iter_ctx ccv_cnnp_model.c:kh_get_ccv_cnnp_parameter_id Line | Count | Source | 231 | 3 | { \ | 232 | 3 | if (h->n_buckets) { \ | 233 | 3 | khint_t k, i, last, mask, step = 0; \ | 234 | 3 | mask = h->n_buckets - 1; \ | 235 | 3 | k = __hash_func(key); i = k & mask; \ | 236 | 3 | last = i; \ | 237 | 3 | while (!__ac_isempty(h->flags, i) && (1 __ac_isdel1 (h->flags, i) || !1 __hash_equal1 (h->keys[i], key))) { \ | 238 | 0 | i = (i + (++step)) & mask; \ | 239 | 0 | if (i == last) return h->n_buckets; \ | 240 | 0 | } \ | 241 | 3 | return __ac_iseither(h->flags, i)? h->n_buckets2 : i1 ; \ | 242 | 3 | } else return 00 ; \ | 243 | 3 | } \ |
Unexecuted instantiation: ccv_cnnp_model.c:kh_get_stream_map Unexecuted instantiation: ccv_cnnp_model.c:kh_get_dy_dev Unexecuted instantiation: ccv_cnnp_model.c:kh_get_dy_str Unexecuted instantiation: ccv_cnnp_model.c:kh_get_dy_alloc Unexecuted instantiation: ccv_cnnp_model.c:kh_get_ccv_cnnp_model_name_bank Unexecuted instantiation: ccv_cnnp_model_io.c:kh_get_stream_map Unexecuted instantiation: ccv_cnnp_model_io.c:kh_get_dy_dev Unexecuted instantiation: ccv_cnnp_model_io.c:kh_get_dy_str Unexecuted instantiation: ccv_cnnp_model_io.c:kh_get_dy_alloc Unexecuted instantiation: ccv_cnnp_model_io.c:kh_get_ccv_cnnp_model_name_bank ccv_cnnp_model_core.c:kh_get_io_node Line | Count | Source | 231 | 3 | { \ | 232 | 3 | if (h->n_buckets) { \ | 233 | 3 | khint_t k, i, last, mask, step = 0; \ | 234 | 3 | mask = h->n_buckets - 1; \ | 235 | 3 | k = __hash_func(key); i = k & mask; \ | 236 | 3 | last = i; \ | 237 | 4 | while (!__ac_isempty(h->flags, i) && (__ac_isdel(h->flags, i) || !__hash_equal(h->keys[i], key))) { \ | 238 | 1 | i = (i + (++step)) & mask; \ | 239 | 1 | if (i == last) return h->n_buckets0 ; \ | 240 | 1 | } \ | 241 | 3 | return __ac_iseither(h->flags, i)? h->n_buckets0 : i; \ | 242 | 3 | } else return 00 ; \ | 243 | 3 | } \ |
ccv_cnnp_model_core.c:kh_get_model Line | Count | Source | 231 | 1 | { \ | 232 | 1 | if (h->n_buckets) { \ | 233 | 1 | khint_t k, i, last, mask, step = 0; \ | 234 | 1 | mask = h->n_buckets - 1; \ | 235 | 1 | k = __hash_func(key); i = k & mask; \ | 236 | 1 | last = i; \ | 237 | 5 | while (!__ac_isempty(h->flags, i) && (__ac_isdel(h->flags, i) || !__hash_equal(h->keys[i], key))) { \ | 238 | 4 | i = (i + (++step)) & mask; \ | 239 | 4 | if (i == last) return h->n_buckets0 ; \ | 240 | 4 | } \ | 241 | 1 | return __ac_iseither(h->flags, i)? h->n_buckets0 : i; \ | 242 | 1 | } else return 00 ; \ | 243 | 1 | } \ |
ccv_cnnp_model_core.c:kh_get_model_io Line | Count | Source | 231 | 100 | { \ | 232 | 100 | if (h->n_buckets) { \ | 233 | 100 | khint_t k, i, last, mask, step = 0; \ | 234 | 100 | mask = h->n_buckets - 1; \ | 235 | 100 | k = __hash_func(key); i = k & mask; \ | 236 | 100 | last = i; \ | 237 | 370 | while (!__ac_isempty(h->flags, i) && (__ac_isdel(h->flags, i) || !__hash_equal(h->keys[i], key))) { \ | 238 | 270 | i = (i + (++step)) & mask; \ | 239 | 270 | if (i == last) return h->n_buckets0 ; \ | 240 | 270 | } \ | 241 | 100 | return __ac_iseither(h->flags, i)? h->n_buckets0 : i; \ | 242 | 100 | } else return 00 ; \ | 243 | 100 | } \ |
Unexecuted instantiation: ccv_cnnp_model_core.c:kh_get_stream_map Unexecuted instantiation: ccv_cnnp_model_core.c:kh_get_dy_dev Unexecuted instantiation: ccv_cnnp_model_core.c:kh_get_dy_str Unexecuted instantiation: ccv_cnnp_model_core.c:kh_get_dy_alloc Unexecuted instantiation: ccv_cnnp_model_core.c:kh_get_ccv_cnnp_model_name_bank Unexecuted instantiation: ccv_cnnp_model_addons.c:kh_get_stream_map Unexecuted instantiation: ccv_cnnp_model_addons.c:kh_get_dy_dev Unexecuted instantiation: ccv_cnnp_model_addons.c:kh_get_dy_str Unexecuted instantiation: ccv_cnnp_model_addons.c:kh_get_dy_alloc Unexecuted instantiation: ccv_cnnp_model_addons.c:kh_get_ccv_cnnp_model_name_bank Unexecuted instantiation: ccv_nnc_palettize.c:kh_get_stream_map ccv_cnnp_model_gradient_checkpointing.c:kh_get_ccv_cnnp_tensor_symbol_map Line | Count | Source | 231 | 32 | { \ | 232 | 32 | if (h->n_buckets) { \ | 233 | 32 | khint_t k, i, last, mask, step = 0; \ | 234 | 32 | mask = h->n_buckets - 1; \ | 235 | 32 | k = __hash_func(key); i = k & mask; \ | 236 | 32 | last = i; \ | 237 | 51 | while (!__ac_isempty(h->flags, i) && (27 __ac_isdel27 (h->flags, i) || !27 __hash_equal27 (h->keys[i], key))) { \ | 238 | 19 | i = (i + (++step)) & mask; \ | 239 | 19 | if (i == last) return h->n_buckets0 ; \ | 240 | 19 | } \ | 241 | 32 | return __ac_iseither(h->flags, i)? h->n_buckets24 : i8 ; \ | 242 | 32 | } else return 00 ; \ | 243 | 32 | } \ |
Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:kh_get_stream_map Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:kh_get_dy_dev Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:kh_get_dy_str Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:kh_get_dy_alloc Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:kh_get_ccv_cnnp_model_name_bank |
244 | | SCOPE int kh_resize_##name(kh_##name##_t *h, khint_t new_n_buckets) \ |
245 | 3.71k | { /* This function uses 0.25*n_buckets bytes of working space instead of [sizeof(key_t+val_t)+.25]*n_buckets. */ \ |
246 | 3.71k | khint32_t *new_flags = 0; \ |
247 | 3.71k | khint_t j = 1; \ |
248 | 3.71k | { \ |
249 | 3.71k | kroundup32(new_n_buckets); \ |
250 | 3.71k | if (new_n_buckets < 4) new_n_buckets = 43.47k ; \ |
251 | 3.71k | if (h->size >= (khint_t)(new_n_buckets * __ac_HASH_UPPER + 0.5)) j = 00 ; /* requested size is too small */ \ |
252 | 3.71k | else { /* hash table size to be changed (shrink or expand); rehash */ \ |
253 | 3.71k | new_flags = (khint32_t*)kmalloc(__ac_fsize(new_n_buckets) * sizeof(khint32_t)); \ |
254 | 3.71k | if (!new_flags) return -10 ; \ |
255 | 3.71k | memset(new_flags, 0xaa, __ac_fsize(new_n_buckets) * sizeof(khint32_t)); \ |
256 | 3.71k | if (h->n_buckets < new_n_buckets) { /* expand */ \ |
257 | 3.60k | khkey_t *new_keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \ |
258 | 3.60k | if (!new_keys) { 0 kfree0 (new_flags); return -1; } \ |
259 | 3.60k | h->keys = new_keys; \ |
260 | 3.60k | if (kh_is_map) { \ |
261 | 3.60k | khval_t *new_vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \ |
262 | 3.60k | if (!new_vals) { 0 kfree0 (new_flags); return -1; } \ |
263 | 3.60k | h->vals = new_vals; \ |
264 | 3.60k | } \ |
265 | 3.60k | } /* otherwise shrink */ \ |
266 | 3.71k | } \ |
267 | 3.71k | } \ |
268 | 3.71k | if (j) { /* rehashing is needed */ \ |
269 | 398k | for (j = 0; j != h->n_buckets; ++j394k ) { \ |
270 | 394k | if (__ac_iseither(h->flags, j) == 0) { \ |
271 | 303k | khkey_t key = h->keys[j]; \ |
272 | 303k | khval_t val; \ |
273 | 303k | khint_t new_mask; \ |
274 | 303k | new_mask = new_n_buckets - 1; \ |
275 | 303k | if (kh_is_map) val = h->vals[j]; \ |
276 | 303k | __ac_set_isdel_true(h->flags, j); \ |
277 | 303k | while (1) { /* kick-out process; sort of like in Cuckoo hashing */ \ |
278 | 303k | khint_t k, i, step = 0; \ |
279 | 303k | k = __hash_func(key); \ |
280 | 303k | i = k & new_mask; \ |
281 | 403k | while (!__ac_isempty(new_flags, i)) i = (i + (++step)) & new_mask99.8k ; \ |
282 | 303k | __ac_set_isempty_false(new_flags, i); \ |
283 | 303k | if (i < h->n_buckets && __ac_iseither150k (h->flags, i) == 0150k ) { /* kick out the existing element */ \ |
284 | 283 | { khkey_t tmp = h->keys[i]; h->keys[i] = key; key = tmp; } \ |
285 | 283 | if (kh_is_map) { khval_t tmp = h->vals[i]; h->vals[i] = val; val = tmp; } \ |
286 | 283 | __ac_set_isdel_true(h->flags, i); /* mark it as deleted in the old hash table */ \ |
287 | 303k | } else { /* write the element and jump out of the loop */ \ |
288 | 303k | h->keys[i] = key; \ |
289 | 303k | if (kh_is_map) h->vals[i] = val; \ |
290 | 303k | break; \ |
291 | 303k | } \ |
292 | 303k | } \ |
293 | 303k | } \ |
294 | 394k | } \ |
295 | 3.71k | if (h->n_buckets > new_n_buckets) { /* shrink the hash table */ \ |
296 | 0 | h->keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \ |
297 | 0 | if (kh_is_map) h->vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \ |
298 | 0 | } \ |
299 | 3.71k | kfree(h->flags); /* free the working space */ \ |
300 | 3.71k | h->flags = new_flags; \ |
301 | 3.71k | h->n_buckets = new_n_buckets; \ |
302 | 3.71k | h->n_occupied = h->size; \ |
303 | 3.71k | h->upper_bound = (khint_t)(h->n_buckets * __ac_HASH_UPPER + 0.5); \ |
304 | 3.71k | } \ |
305 | 3.71k | return 0; \ |
306 | 3.71k | } \ Unexecuted instantiation: while.backward.tests.c:kh_resize_stream_map Unexecuted instantiation: tape.tests.c:kh_resize_stream_map imdb.tests.c:kh_resize_vocab_map Line | Count | Source | 245 | 48 | { /* This function uses 0.25*n_buckets bytes of working space instead of [sizeof(key_t+val_t)+.25]*n_buckets. */ \ | 246 | 48 | khint32_t *new_flags = 0; \ | 247 | 48 | khint_t j = 1; \ | 248 | 48 | { \ | 249 | 48 | kroundup32(new_n_buckets); \ | 250 | 48 | if (new_n_buckets < 4) new_n_buckets = 43 ; \ | 251 | 48 | if (h->size >= (khint_t)(new_n_buckets * __ac_HASH_UPPER + 0.5)) j = 00 ; /* requested size is too small */ \ | 252 | 48 | else { /* hash table size to be changed (shrink or expand); rehash */ \ | 253 | 48 | new_flags = (khint32_t*)kmalloc(__ac_fsize(new_n_buckets) * sizeof(khint32_t)); \ | 254 | 48 | if (!new_flags) return -10 ; \ | 255 | 48 | memset(new_flags, 0xaa, __ac_fsize(new_n_buckets) * sizeof(khint32_t)); \ | 256 | 48 | if (h->n_buckets < new_n_buckets) { /* expand */ \ | 257 | 48 | khkey_t *new_keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \ | 258 | 48 | if (!new_keys) { 0 kfree0 (new_flags); return -1; } \ | 259 | 48 | h->keys = new_keys; \ | 260 | 48 | if (kh_is_map) { \ | 261 | 48 | khval_t *new_vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \ | 262 | 48 | if (!new_vals) { 0 kfree0 (new_flags); return -1; } \ | 263 | 48 | h->vals = new_vals; \ | 264 | 48 | } \ | 265 | 48 | } /* otherwise shrink */ \ | 266 | 48 | } \ | 267 | 48 | } \ | 268 | 48 | if (j) { /* rehashing is needed */ \ | 269 | 393k | for (j = 0; j != h->n_buckets; ++j393k ) { \ | 270 | 393k | if (__ac_iseither(h->flags, j) == 0) { \ | 271 | 302k | khkey_t key = h->keys[j]; \ | 272 | 302k | khval_t val; \ | 273 | 302k | khint_t new_mask; \ | 274 | 302k | new_mask = new_n_buckets - 1; \ | 275 | 302k | if (kh_is_map) val = h->vals[j]; \ | 276 | 302k | __ac_set_isdel_true(h->flags, j); \ | 277 | 302k | while (1) { /* kick-out process; sort of like in Cuckoo hashing */ \ | 278 | 302k | khint_t k, i, step = 0; \ | 279 | 302k | k = __hash_func(key); \ | 280 | 302k | i = k & new_mask; \ | 281 | 400k | while (!__ac_isempty(new_flags, i)) i = (i + (++step)) & new_mask97.4k ; \ | 282 | 302k | __ac_set_isempty_false(new_flags, i); \ | 283 | 302k | if (i < h->n_buckets && __ac_iseither150k (h->flags, i) == 0150k ) { /* kick out the existing element */ \ | 284 | 174 | { khkey_t tmp = h->keys[i]; h->keys[i] = key; key = tmp; } \ | 285 | 174 | if (kh_is_map) { khval_t tmp = h->vals[i]; h->vals[i] = val; val = tmp; } \ | 286 | 174 | __ac_set_isdel_true(h->flags, i); /* mark it as deleted in the old hash table */ \ | 287 | 302k | } else { /* write the element and jump out of the loop */ \ | 288 | 302k | h->keys[i] = key; \ | 289 | 302k | if (kh_is_map) h->vals[i] = val; \ | 290 | 302k | break; \ | 291 | 302k | } \ | 292 | 302k | } \ | 293 | 302k | } \ | 294 | 393k | } \ | 295 | 48 | if (h->n_buckets > new_n_buckets) { /* shrink the hash table */ \ | 296 | 0 | h->keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \ | 297 | 0 | if (kh_is_map) h->vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \ | 298 | 0 | } \ | 299 | 48 | kfree(h->flags); /* free the working space */ \ | 300 | 48 | h->flags = new_flags; \ | 301 | 48 | h->n_buckets = new_n_buckets; \ | 302 | 48 | h->n_occupied = h->size; \ | 303 | 48 | h->upper_bound = (khint_t)(h->n_buckets * __ac_HASH_UPPER + 0.5); \ | 304 | 48 | } \ | 305 | 48 | return 0; \ | 306 | 48 | } \ |
Unexecuted instantiation: ccv_nnc_cmd.c:kh_resize_stream_map Unexecuted instantiation: ccv_nnc_tensor.c:kh_resize_stream_map Unexecuted instantiation: ccv_nnc_tensor_io.c:kh_resize_stream_map Unexecuted instantiation: ccv_nnc_stream.c:kh_resize_stream_map ccv_nnc_micro.c:kh_resize_ccv_nnc_ids Line | Count | Source | 245 | 3 | { /* This function uses 0.25*n_buckets bytes of working space instead of [sizeof(key_t+val_t)+.25]*n_buckets. */ \ | 246 | 3 | khint32_t *new_flags = 0; \ | 247 | 3 | khint_t j = 1; \ | 248 | 3 | { \ | 249 | 3 | kroundup32(new_n_buckets); \ | 250 | 3 | if (new_n_buckets < 4) new_n_buckets = 4; \ | 251 | 3 | if (h->size >= (khint_t)(new_n_buckets * __ac_HASH_UPPER + 0.5)) j = 00 ; /* requested size is too small */ \ | 252 | 3 | else { /* hash table size to be changed (shrink or expand); rehash */ \ | 253 | 3 | new_flags = (khint32_t*)kmalloc(__ac_fsize(new_n_buckets) * sizeof(khint32_t)); \ | 254 | 3 | if (!new_flags) return -10 ; \ | 255 | 3 | memset(new_flags, 0xaa, __ac_fsize(new_n_buckets) * sizeof(khint32_t)); \ | 256 | 3 | if (h->n_buckets < new_n_buckets) { /* expand */ \ | 257 | 3 | khkey_t *new_keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \ | 258 | 3 | if (!new_keys) { 0 kfree0 (new_flags); return -1; } \ | 259 | 3 | h->keys = new_keys; \ | 260 | 3 | if (kh_is_map) { \ | 261 | 0 | khval_t *new_vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \ | 262 | 0 | if (!new_vals) { kfree(new_flags); return -1; } \ | 263 | 0 | h->vals = new_vals; \ | 264 | 0 | } \ | 265 | 3 | } /* otherwise shrink */ \ | 266 | 3 | } \ | 267 | 3 | } \ | 268 | 3 | if (j) { /* rehashing is needed */ \ | 269 | 3 | for (j = 0; j != h->n_buckets; ++j0 ) { \ | 270 | 0 | if (__ac_iseither(h->flags, j) == 0) { \ | 271 | 0 | khkey_t key = h->keys[j]; \ | 272 | 0 | khval_t val; \ | 273 | 0 | khint_t new_mask; \ | 274 | 0 | new_mask = new_n_buckets - 1; \ | 275 | 0 | if (kh_is_map) val = h->vals[j]; \ | 276 | 0 | __ac_set_isdel_true(h->flags, j); \ | 277 | 0 | while (1) { /* kick-out process; sort of like in Cuckoo hashing */ \ | 278 | 0 | khint_t k, i, step = 0; \ | 279 | 0 | k = __hash_func(key); \ | 280 | 0 | i = k & new_mask; \ | 281 | 0 | while (!__ac_isempty(new_flags, i)) i = (i + (++step)) & new_mask; \ | 282 | 0 | __ac_set_isempty_false(new_flags, i); \ | 283 | 0 | if (i < h->n_buckets && __ac_iseither(h->flags, i) == 0) { /* kick out the existing element */ \ | 284 | 0 | { khkey_t tmp = h->keys[i]; h->keys[i] = key; key = tmp; } \ | 285 | 0 | if (kh_is_map) { khval_t tmp = h->vals[i]; h->vals[i] = val; val = tmp; } \ | 286 | 0 | __ac_set_isdel_true(h->flags, i); /* mark it as deleted in the old hash table */ \ | 287 | 0 | } else { /* write the element and jump out of the loop */ \ | 288 | 0 | h->keys[i] = key; \ | 289 | 0 | if (kh_is_map) h->vals[i] = val; \ | 290 | 0 | break; \ | 291 | 0 | } \ | 292 | 0 | } \ | 293 | 0 | } \ | 294 | 0 | } \ | 295 | 3 | if (h->n_buckets > new_n_buckets) { /* shrink the hash table */ \ | 296 | 0 | h->keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \ | 297 | 0 | if (kh_is_map) h->vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \ | 298 | 0 | } \ | 299 | 3 | kfree(h->flags); /* free the working space */ \ | 300 | 3 | h->flags = new_flags; \ | 301 | 3 | h->n_buckets = new_n_buckets; \ | 302 | 3 | h->n_occupied = h->size; \ | 303 | 3 | h->upper_bound = (khint_t)(h->n_buckets * __ac_HASH_UPPER + 0.5); \ | 304 | 3 | } \ | 305 | 3 | return 0; \ | 306 | 3 | } \ |
ccv_nnc_micro.c:kh_resize_ccv_nnc_micro_bind_scalar Line | Count | Source | 245 | 1 | { /* This function uses 0.25*n_buckets bytes of working space instead of [sizeof(key_t+val_t)+.25]*n_buckets. */ \ | 246 | 1 | khint32_t *new_flags = 0; \ | 247 | 1 | khint_t j = 1; \ | 248 | 1 | { \ | 249 | 1 | kroundup32(new_n_buckets); \ | 250 | 1 | if (new_n_buckets < 4) new_n_buckets = 4; \ | 251 | 1 | if (h->size >= (khint_t)(new_n_buckets * __ac_HASH_UPPER + 0.5)) j = 00 ; /* requested size is too small */ \ | 252 | 1 | else { /* hash table size to be changed (shrink or expand); rehash */ \ | 253 | 1 | new_flags = (khint32_t*)kmalloc(__ac_fsize(new_n_buckets) * sizeof(khint32_t)); \ | 254 | 1 | if (!new_flags) return -10 ; \ | 255 | 1 | memset(new_flags, 0xaa, __ac_fsize(new_n_buckets) * sizeof(khint32_t)); \ | 256 | 1 | if (h->n_buckets < new_n_buckets) { /* expand */ \ | 257 | 1 | khkey_t *new_keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \ | 258 | 1 | if (!new_keys) { 0 kfree0 (new_flags); return -1; } \ | 259 | 1 | h->keys = new_keys; \ | 260 | 1 | if (kh_is_map) { \ | 261 | 1 | khval_t *new_vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \ | 262 | 1 | if (!new_vals) { 0 kfree0 (new_flags); return -1; } \ | 263 | 1 | h->vals = new_vals; \ | 264 | 1 | } \ | 265 | 1 | } /* otherwise shrink */ \ | 266 | 1 | } \ | 267 | 1 | } \ | 268 | 1 | if (j) { /* rehashing is needed */ \ | 269 | 1 | for (j = 0; j != h->n_buckets; ++j0 ) { \ | 270 | 0 | if (__ac_iseither(h->flags, j) == 0) { \ | 271 | 0 | khkey_t key = h->keys[j]; \ | 272 | 0 | khval_t val; \ | 273 | 0 | khint_t new_mask; \ | 274 | 0 | new_mask = new_n_buckets - 1; \ | 275 | 0 | if (kh_is_map) val = h->vals[j]; \ | 276 | 0 | __ac_set_isdel_true(h->flags, j); \ | 277 | 0 | while (1) { /* kick-out process; sort of like in Cuckoo hashing */ \ | 278 | 0 | khint_t k, i, step = 0; \ | 279 | 0 | k = __hash_func(key); \ | 280 | 0 | i = k & new_mask; \ | 281 | 0 | while (!__ac_isempty(new_flags, i)) i = (i + (++step)) & new_mask; \ | 282 | 0 | __ac_set_isempty_false(new_flags, i); \ | 283 | 0 | if (i < h->n_buckets && __ac_iseither(h->flags, i) == 0) { /* kick out the existing element */ \ | 284 | 0 | { khkey_t tmp = h->keys[i]; h->keys[i] = key; key = tmp; } \ | 285 | 0 | if (kh_is_map) { khval_t tmp = h->vals[i]; h->vals[i] = val; val = tmp; } \ | 286 | 0 | __ac_set_isdel_true(h->flags, i); /* mark it as deleted in the old hash table */ \ | 287 | 0 | } else { /* write the element and jump out of the loop */ \ | 288 | 0 | h->keys[i] = key; \ | 289 | 0 | if (kh_is_map) h->vals[i] = val; \ | 290 | 0 | break; \ | 291 | 0 | } \ | 292 | 0 | } \ | 293 | 0 | } \ | 294 | 0 | } \ | 295 | 1 | if (h->n_buckets > new_n_buckets) { /* shrink the hash table */ \ | 296 | 0 | h->keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \ | 297 | 0 | if (kh_is_map) h->vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \ | 298 | 0 | } \ | 299 | 1 | kfree(h->flags); /* free the working space */ \ | 300 | 1 | h->flags = new_flags; \ | 301 | 1 | h->n_buckets = new_n_buckets; \ | 302 | 1 | h->n_occupied = h->size; \ | 303 | 1 | h->upper_bound = (khint_t)(h->n_buckets * __ac_HASH_UPPER + 0.5); \ | 304 | 1 | } \ | 305 | 1 | return 0; \ | 306 | 1 | } \ |
ccv_nnc_micro_simplify.c:kh_resize_ccv_nnc_axis_id_group Line | Count | Source | 245 | 4 | { /* This function uses 0.25*n_buckets bytes of working space instead of [sizeof(key_t+val_t)+.25]*n_buckets. */ \ | 246 | 4 | khint32_t *new_flags = 0; \ | 247 | 4 | khint_t j = 1; \ | 248 | 4 | { \ | 249 | 4 | kroundup32(new_n_buckets); \ | 250 | 4 | if (new_n_buckets < 4) new_n_buckets = 4; \ | 251 | 4 | if (h->size >= (khint_t)(new_n_buckets * __ac_HASH_UPPER + 0.5)) j = 00 ; /* requested size is too small */ \ | 252 | 4 | else { /* hash table size to be changed (shrink or expand); rehash */ \ | 253 | 4 | new_flags = (khint32_t*)kmalloc(__ac_fsize(new_n_buckets) * sizeof(khint32_t)); \ | 254 | 4 | if (!new_flags) return -10 ; \ | 255 | 4 | memset(new_flags, 0xaa, __ac_fsize(new_n_buckets) * sizeof(khint32_t)); \ | 256 | 4 | if (h->n_buckets < new_n_buckets) { /* expand */ \ | 257 | 4 | khkey_t *new_keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \ | 258 | 4 | if (!new_keys) { 0 kfree0 (new_flags); return -1; } \ | 259 | 4 | h->keys = new_keys; \ | 260 | 4 | if (kh_is_map) { \ | 261 | 4 | khval_t *new_vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \ | 262 | 4 | if (!new_vals) { 0 kfree0 (new_flags); return -1; } \ | 263 | 4 | h->vals = new_vals; \ | 264 | 4 | } \ | 265 | 4 | } /* otherwise shrink */ \ | 266 | 4 | } \ | 267 | 4 | } \ | 268 | 4 | if (j) { /* rehashing is needed */ \ | 269 | 4 | for (j = 0; j != h->n_buckets; ++j0 ) { \ | 270 | 0 | if (__ac_iseither(h->flags, j) == 0) { \ | 271 | 0 | khkey_t key = h->keys[j]; \ | 272 | 0 | khval_t val; \ | 273 | 0 | khint_t new_mask; \ | 274 | 0 | new_mask = new_n_buckets - 1; \ | 275 | 0 | if (kh_is_map) val = h->vals[j]; \ | 276 | 0 | __ac_set_isdel_true(h->flags, j); \ | 277 | 0 | while (1) { /* kick-out process; sort of like in Cuckoo hashing */ \ | 278 | 0 | khint_t k, i, step = 0; \ | 279 | 0 | k = __hash_func(key); \ | 280 | 0 | i = k & new_mask; \ | 281 | 0 | while (!__ac_isempty(new_flags, i)) i = (i + (++step)) & new_mask; \ | 282 | 0 | __ac_set_isempty_false(new_flags, i); \ | 283 | 0 | if (i < h->n_buckets && __ac_iseither(h->flags, i) == 0) { /* kick out the existing element */ \ | 284 | 0 | { khkey_t tmp = h->keys[i]; h->keys[i] = key; key = tmp; } \ | 285 | 0 | if (kh_is_map) { khval_t tmp = h->vals[i]; h->vals[i] = val; val = tmp; } \ | 286 | 0 | __ac_set_isdel_true(h->flags, i); /* mark it as deleted in the old hash table */ \ | 287 | 0 | } else { /* write the element and jump out of the loop */ \ | 288 | 0 | h->keys[i] = key; \ | 289 | 0 | if (kh_is_map) h->vals[i] = val; \ | 290 | 0 | break; \ | 291 | 0 | } \ | 292 | 0 | } \ | 293 | 0 | } \ | 294 | 0 | } \ | 295 | 4 | if (h->n_buckets > new_n_buckets) { /* shrink the hash table */ \ | 296 | 0 | h->keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \ | 297 | 0 | if (kh_is_map) h->vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \ | 298 | 0 | } \ | 299 | 4 | kfree(h->flags); /* free the working space */ \ | 300 | 4 | h->flags = new_flags; \ | 301 | 4 | h->n_buckets = new_n_buckets; \ | 302 | 4 | h->n_occupied = h->size; \ | 303 | 4 | h->upper_bound = (khint_t)(h->n_buckets * __ac_HASH_UPPER + 0.5); \ | 304 | 4 | } \ | 305 | 4 | return 0; \ | 306 | 4 | } \ |
Unexecuted instantiation: ccv_nnc_graph.c:kh_resize_stream_map Unexecuted instantiation: ccv_nnc_symbolic_graph_io.c:kh_resize_stream_map Unexecuted instantiation: ccv_nnc_symbolic_graph_compile.c:kh_resize_stream_map Unexecuted instantiation: ccv_nnc_symbolic_graph_compile.c:kh_resize_obj_ptr Unexecuted instantiation: ccv_nnc_graph_while.c:kh_resize_stream_map Unexecuted instantiation: ccv_nnc_tensor_tape.c:kh_resize_stream_map Unexecuted instantiation: ccv_nnc_graph_case_of.c:kh_resize_stream_map Unexecuted instantiation: ccv_nnc_graph_run.c:kh_resize_stream_map ccv_nnc_xpu_alloc.c:kh_resize_dy_str Line | Count | Source | 245 | 12 | { /* This function uses 0.25*n_buckets bytes of working space instead of [sizeof(key_t+val_t)+.25]*n_buckets. */ \ | 246 | 12 | khint32_t *new_flags = 0; \ | 247 | 12 | khint_t j = 1; \ | 248 | 12 | { \ | 249 | 12 | kroundup32(new_n_buckets); \ | 250 | 12 | if (new_n_buckets < 4) new_n_buckets = 4; \ | 251 | 12 | if (h->size >= (khint_t)(new_n_buckets * __ac_HASH_UPPER + 0.5)) j = 00 ; /* requested size is too small */ \ | 252 | 12 | else { /* hash table size to be changed (shrink or expand); rehash */ \ | 253 | 12 | new_flags = (khint32_t*)kmalloc(__ac_fsize(new_n_buckets) * sizeof(khint32_t)); \ | 254 | 12 | if (!new_flags) return -10 ; \ | 255 | 12 | memset(new_flags, 0xaa, __ac_fsize(new_n_buckets) * sizeof(khint32_t)); \ | 256 | 12 | if (h->n_buckets < new_n_buckets) { /* expand */ \ | 257 | 12 | khkey_t *new_keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \ | 258 | 12 | if (!new_keys) { 0 kfree0 (new_flags); return -1; } \ | 259 | 12 | h->keys = new_keys; \ | 260 | 12 | if (kh_is_map) { \ | 261 | 12 | khval_t *new_vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \ | 262 | 12 | if (!new_vals) { 0 kfree0 (new_flags); return -1; } \ | 263 | 12 | h->vals = new_vals; \ | 264 | 12 | } \ | 265 | 12 | } /* otherwise shrink */ \ | 266 | 12 | } \ | 267 | 12 | } \ | 268 | 12 | if (j) { /* rehashing is needed */ \ | 269 | 12 | for (j = 0; j != h->n_buckets; ++j0 ) { \ | 270 | 0 | if (__ac_iseither(h->flags, j) == 0) { \ | 271 | 0 | khkey_t key = h->keys[j]; \ | 272 | 0 | khval_t val; \ | 273 | 0 | khint_t new_mask; \ | 274 | 0 | new_mask = new_n_buckets - 1; \ | 275 | 0 | if (kh_is_map) val = h->vals[j]; \ | 276 | 0 | __ac_set_isdel_true(h->flags, j); \ | 277 | 0 | while (1) { /* kick-out process; sort of like in Cuckoo hashing */ \ | 278 | 0 | khint_t k, i, step = 0; \ | 279 | 0 | k = __hash_func(key); \ | 280 | 0 | i = k & new_mask; \ | 281 | 0 | while (!__ac_isempty(new_flags, i)) i = (i + (++step)) & new_mask; \ | 282 | 0 | __ac_set_isempty_false(new_flags, i); \ | 283 | 0 | if (i < h->n_buckets && __ac_iseither(h->flags, i) == 0) { /* kick out the existing element */ \ | 284 | 0 | { khkey_t tmp = h->keys[i]; h->keys[i] = key; key = tmp; } \ | 285 | 0 | if (kh_is_map) { khval_t tmp = h->vals[i]; h->vals[i] = val; val = tmp; } \ | 286 | 0 | __ac_set_isdel_true(h->flags, i); /* mark it as deleted in the old hash table */ \ | 287 | 0 | } else { /* write the element and jump out of the loop */ \ | 288 | 0 | h->keys[i] = key; \ | 289 | 0 | if (kh_is_map) h->vals[i] = val; \ | 290 | 0 | break; \ | 291 | 0 | } \ | 292 | 0 | } \ | 293 | 0 | } \ | 294 | 0 | } \ | 295 | 12 | if (h->n_buckets > new_n_buckets) { /* shrink the hash table */ \ | 296 | 0 | h->keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \ | 297 | 0 | if (kh_is_map) h->vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \ | 298 | 0 | } \ | 299 | 12 | kfree(h->flags); /* free the working space */ \ | 300 | 12 | h->flags = new_flags; \ | 301 | 12 | h->n_buckets = new_n_buckets; \ | 302 | 12 | h->n_occupied = h->size; \ | 303 | 12 | h->upper_bound = (khint_t)(h->n_buckets * __ac_HASH_UPPER + 0.5); \ | 304 | 12 | } \ | 305 | 12 | return 0; \ | 306 | 12 | } \ |
ccv_nnc_xpu_alloc.c:kh_resize_dy_alloc Line | Count | Source | 245 | 137 | { /* This function uses 0.25*n_buckets bytes of working space instead of [sizeof(key_t+val_t)+.25]*n_buckets. */ \ | 246 | 137 | khint32_t *new_flags = 0; \ | 247 | 137 | khint_t j = 1; \ | 248 | 137 | { \ | 249 | 137 | kroundup32(new_n_buckets); \ | 250 | 137 | if (new_n_buckets < 4) new_n_buckets = 412 ; \ | 251 | 137 | if (h->size >= (khint_t)(new_n_buckets * __ac_HASH_UPPER + 0.5)) j = 00 ; /* requested size is too small */ \ | 252 | 137 | else { /* hash table size to be changed (shrink or expand); rehash */ \ | 253 | 137 | new_flags = (khint32_t*)kmalloc(__ac_fsize(new_n_buckets) * sizeof(khint32_t)); \ | 254 | 137 | if (!new_flags) return -10 ; \ | 255 | 137 | memset(new_flags, 0xaa, __ac_fsize(new_n_buckets) * sizeof(khint32_t)); \ | 256 | 137 | if (h->n_buckets < new_n_buckets) { /* expand */ \ | 257 | 35 | khkey_t *new_keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \ | 258 | 35 | if (!new_keys) { 0 kfree0 (new_flags); return -1; } \ | 259 | 35 | h->keys = new_keys; \ | 260 | 35 | if (kh_is_map) { \ | 261 | 35 | khval_t *new_vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \ | 262 | 35 | if (!new_vals) { 0 kfree0 (new_flags); return -1; } \ | 263 | 35 | h->vals = new_vals; \ | 264 | 35 | } \ | 265 | 35 | } /* otherwise shrink */ \ | 266 | 137 | } \ | 267 | 137 | } \ | 268 | 137 | if (j) { /* rehashing is needed */ \ | 269 | 913 | for (j = 0; j != h->n_buckets; ++j776 ) { \ | 270 | 776 | if (__ac_iseither(h->flags, j) == 0) { \ | 271 | 189 | khkey_t key = h->keys[j]; \ | 272 | 189 | khval_t val; \ | 273 | 189 | khint_t new_mask; \ | 274 | 189 | new_mask = new_n_buckets - 1; \ | 275 | 189 | if (kh_is_map) val = h->vals[j]; \ | 276 | 189 | __ac_set_isdel_true(h->flags, j); \ | 277 | 263 | while (1) { /* kick-out process; sort of like in Cuckoo hashing */ \ | 278 | 263 | khint_t k, i, step = 0; \ | 279 | 263 | k = __hash_func(key); \ | 280 | 263 | i = k & new_mask; \ | 281 | 2.22k | while (!__ac_isempty(new_flags, i)) i = (i + (++step)) & new_mask1.96k ; \ | 282 | 263 | __ac_set_isempty_false(new_flags, i); \ | 283 | 263 | if (i < h->n_buckets && __ac_iseither138 (h->flags, i) == 0138 ) { /* kick out the existing element */ \ | 284 | 74 | { khkey_t tmp = h->keys[i]; h->keys[i] = key; key = tmp; } \ | 285 | 74 | if (kh_is_map) { khval_t tmp = h->vals[i]; h->vals[i] = val; val = tmp; } \ | 286 | 74 | __ac_set_isdel_true(h->flags, i); /* mark it as deleted in the old hash table */ \ | 287 | 189 | } else { /* write the element and jump out of the loop */ \ | 288 | 189 | h->keys[i] = key; \ | 289 | 189 | if (kh_is_map) h->vals[i] = val; \ | 290 | 189 | break; \ | 291 | 189 | } \ | 292 | 263 | } \ | 293 | 189 | } \ | 294 | 776 | } \ | 295 | 137 | if (h->n_buckets > new_n_buckets) { /* shrink the hash table */ \ | 296 | 0 | h->keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \ | 297 | 0 | if (kh_is_map) h->vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \ | 298 | 0 | } \ | 299 | 137 | kfree(h->flags); /* free the working space */ \ | 300 | 137 | h->flags = new_flags; \ | 301 | 137 | h->n_buckets = new_n_buckets; \ | 302 | 137 | h->n_occupied = h->size; \ | 303 | 137 | h->upper_bound = (khint_t)(h->n_buckets * __ac_HASH_UPPER + 0.5); \ | 304 | 137 | } \ | 305 | 137 | return 0; \ | 306 | 137 | } \ |
ccv_nnc_xpu_alloc.c:kh_resize_dy_dev Line | Count | Source | 245 | 23 | { /* This function uses 0.25*n_buckets bytes of working space instead of [sizeof(key_t+val_t)+.25]*n_buckets. */ \ | 246 | 23 | khint32_t *new_flags = 0; \ | 247 | 23 | khint_t j = 1; \ | 248 | 23 | { \ | 249 | 23 | kroundup32(new_n_buckets); \ | 250 | 23 | if (new_n_buckets < 4) new_n_buckets = 419 ; \ | 251 | 23 | if (h->size >= (khint_t)(new_n_buckets * __ac_HASH_UPPER + 0.5)) j = 00 ; /* requested size is too small */ \ | 252 | 23 | else { /* hash table size to be changed (shrink or expand); rehash */ \ | 253 | 23 | new_flags = (khint32_t*)kmalloc(__ac_fsize(new_n_buckets) * sizeof(khint32_t)); \ | 254 | 23 | if (!new_flags) return -10 ; \ | 255 | 23 | memset(new_flags, 0xaa, __ac_fsize(new_n_buckets) * sizeof(khint32_t)); \ | 256 | 23 | if (h->n_buckets < new_n_buckets) { /* expand */ \ | 257 | 23 | khkey_t *new_keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \ | 258 | 23 | if (!new_keys) { 0 kfree0 (new_flags); return -1; } \ | 259 | 23 | h->keys = new_keys; \ | 260 | 23 | if (kh_is_map) { \ | 261 | 23 | khval_t *new_vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \ | 262 | 23 | if (!new_vals) { 0 kfree0 (new_flags); return -1; } \ | 263 | 23 | h->vals = new_vals; \ | 264 | 23 | } \ | 265 | 23 | } /* otherwise shrink */ \ | 266 | 23 | } \ | 267 | 23 | } \ | 268 | 23 | if (j) { /* rehashing is needed */ \ | 269 | 39 | for (j = 0; j != h->n_buckets; ++j16 ) { \ | 270 | 16 | if (__ac_iseither(h->flags, j) == 0) { \ | 271 | 12 | khkey_t key = h->keys[j]; \ | 272 | 12 | khval_t val; \ | 273 | 12 | khint_t new_mask; \ | 274 | 12 | new_mask = new_n_buckets - 1; \ | 275 | 12 | if (kh_is_map) val = h->vals[j]; \ | 276 | 12 | __ac_set_isdel_true(h->flags, j); \ | 277 | 12 | while (1) { /* kick-out process; sort of like in Cuckoo hashing */ \ | 278 | 12 | khint_t k, i, step = 0; \ | 279 | 12 | k = __hash_func(key); \ | 280 | 12 | i = k & new_mask; \ | 281 | 12 | while (!__ac_isempty(new_flags, i)) i = (i + (++step)) & new_mask0 ; \ | 282 | 12 | __ac_set_isempty_false(new_flags, i); \ | 283 | 12 | if (i < h->n_buckets && __ac_iseither(h->flags, i) == 0) { /* kick out the existing element */ \ | 284 | 0 | { khkey_t tmp = h->keys[i]; h->keys[i] = key; key = tmp; } \ | 285 | 0 | if (kh_is_map) { khval_t tmp = h->vals[i]; h->vals[i] = val; val = tmp; } \ | 286 | 0 | __ac_set_isdel_true(h->flags, i); /* mark it as deleted in the old hash table */ \ | 287 | 12 | } else { /* write the element and jump out of the loop */ \ | 288 | 12 | h->keys[i] = key; \ | 289 | 12 | if (kh_is_map) h->vals[i] = val; \ | 290 | 12 | break; \ | 291 | 12 | } \ | 292 | 12 | } \ | 293 | 12 | } \ | 294 | 16 | } \ | 295 | 23 | if (h->n_buckets > new_n_buckets) { /* shrink the hash table */ \ | 296 | 0 | h->keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \ | 297 | 0 | if (kh_is_map) h->vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \ | 298 | 0 | } \ | 299 | 23 | kfree(h->flags); /* free the working space */ \ | 300 | 23 | h->flags = new_flags; \ | 301 | 23 | h->n_buckets = new_n_buckets; \ | 302 | 23 | h->n_occupied = h->size; \ | 303 | 23 | h->upper_bound = (khint_t)(h->n_buckets * __ac_HASH_UPPER + 0.5); \ | 304 | 23 | } \ | 305 | 23 | return 0; \ | 306 | 23 | } \ |
Unexecuted instantiation: ccv_nnc_xpu_alloc.c:kh_resize_stream_map ccv_nnc_dynamic_graph.c:kh_resize_stream_map Line | Count | Source | 245 | 12 | { /* This function uses 0.25*n_buckets bytes of working space instead of [sizeof(key_t+val_t)+.25]*n_buckets. */ \ | 246 | 12 | khint32_t *new_flags = 0; \ | 247 | 12 | khint_t j = 1; \ | 248 | 12 | { \ | 249 | 12 | kroundup32(new_n_buckets); \ | 250 | 12 | if (new_n_buckets < 4) new_n_buckets = 410 ; \ | 251 | 12 | if (h->size >= (khint_t)(new_n_buckets * __ac_HASH_UPPER + 0.5)) j = 00 ; /* requested size is too small */ \ | 252 | 12 | else { /* hash table size to be changed (shrink or expand); rehash */ \ | 253 | 12 | new_flags = (khint32_t*)kmalloc(__ac_fsize(new_n_buckets) * sizeof(khint32_t)); \ | 254 | 12 | if (!new_flags) return -10 ; \ | 255 | 12 | memset(new_flags, 0xaa, __ac_fsize(new_n_buckets) * sizeof(khint32_t)); \ | 256 | 12 | if (h->n_buckets < new_n_buckets) { /* expand */ \ | 257 | 12 | khkey_t *new_keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \ | 258 | 12 | if (!new_keys) { 0 kfree0 (new_flags); return -1; } \ | 259 | 12 | h->keys = new_keys; \ | 260 | 12 | if (kh_is_map) { \ | 261 | 12 | khval_t *new_vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \ | 262 | 12 | if (!new_vals) { 0 kfree0 (new_flags); return -1; } \ | 263 | 12 | h->vals = new_vals; \ | 264 | 12 | } \ | 265 | 12 | } /* otherwise shrink */ \ | 266 | 12 | } \ | 267 | 12 | } \ | 268 | 12 | if (j) { /* rehashing is needed */ \ | 269 | 20 | for (j = 0; j != h->n_buckets; ++j8 ) { \ | 270 | 8 | if (__ac_iseither(h->flags, j) == 0) { \ | 271 | 2 | khkey_t key = h->keys[j]; \ | 272 | 2 | khval_t val; \ | 273 | 2 | khint_t new_mask; \ | 274 | 2 | new_mask = new_n_buckets - 1; \ | 275 | 2 | if (kh_is_map) val = h->vals[j]; \ | 276 | 2 | __ac_set_isdel_true(h->flags, j); \ | 277 | 6 | while (1) { /* kick-out process; sort of like in Cuckoo hashing */ \ | 278 | 6 | khint_t k, i, step = 0; \ | 279 | 6 | k = __hash_func(key); \ | 280 | 6 | i = k & new_mask; \ | 281 | 12 | while (!__ac_isempty(new_flags, i)) i = (i + (++step)) & new_mask6 ; \ | 282 | 6 | __ac_set_isempty_false(new_flags, i); \ | 283 | 6 | if (i < h->n_buckets && __ac_iseither4 (h->flags, i) == 04 ) { /* kick out the existing element */ \ | 284 | 4 | { khkey_t tmp = h->keys[i]; h->keys[i] = key; key = tmp; } \ | 285 | 4 | if (kh_is_map) { khval_t tmp = h->vals[i]; h->vals[i] = val; val = tmp; } \ | 286 | 4 | __ac_set_isdel_true(h->flags, i); /* mark it as deleted in the old hash table */ \ | 287 | 4 | } else { /* write the element and jump out of the loop */ \ | 288 | 2 | h->keys[i] = key; \ | 289 | 2 | if (kh_is_map) h->vals[i] = val; \ | 290 | 2 | break; \ | 291 | 2 | } \ | 292 | 6 | } \ | 293 | 2 | } \ | 294 | 8 | } \ | 295 | 12 | if (h->n_buckets > new_n_buckets) { /* shrink the hash table */ \ | 296 | 0 | h->keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \ | 297 | 0 | if (kh_is_map) h->vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \ | 298 | 0 | } \ | 299 | 12 | kfree(h->flags); /* free the working space */ \ | 300 | 12 | h->flags = new_flags; \ | 301 | 12 | h->n_buckets = new_n_buckets; \ | 302 | 12 | h->n_occupied = h->size; \ | 303 | 12 | h->upper_bound = (khint_t)(h->n_buckets * __ac_HASH_UPPER + 0.5); \ | 304 | 12 | } \ | 305 | 12 | return 0; \ | 306 | 12 | } \ |
Unexecuted instantiation: ccv_nnc_dynamic_graph.c:kh_resize_dy_dev Unexecuted instantiation: ccv_nnc_dynamic_graph.c:kh_resize_dy_str Unexecuted instantiation: ccv_nnc_dynamic_graph.c:kh_resize_dy_alloc Unexecuted instantiation: ccv_nnc_dynamic_graph.c:kh_resize_stateful_exec Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:kh_resize_stream_map Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:kh_resize_dy_dev Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:kh_resize_dy_str Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:kh_resize_dy_alloc Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:kh_resize_stateful_exec Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:kh_resize_stream_map Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:kh_resize_dy_dev Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:kh_resize_dy_str Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:kh_resize_dy_alloc Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:kh_resize_stateful_exec Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:kh_resize_stream_map Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:kh_resize_dy_dev Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:kh_resize_dy_str Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:kh_resize_dy_alloc Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:kh_resize_stateful_exec Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:kh_resize_stream_map Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:kh_resize_dy_dev Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:kh_resize_dy_str Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:kh_resize_dy_alloc Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:kh_resize_stateful_exec Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:kh_resize_stream_map Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:kh_resize_dy_dev Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:kh_resize_dy_str Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:kh_resize_dy_alloc Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:kh_resize_stateful_exec Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:kh_resize_ccv_cnnp_model_name_bank ccv_cnnp_dataframe.c:kh_resize_ctx Line | Count | Source | 245 | 56 | { /* This function uses 0.25*n_buckets bytes of working space instead of [sizeof(key_t+val_t)+.25]*n_buckets. */ \ | 246 | 56 | khint32_t *new_flags = 0; \ | 247 | 56 | khint_t j = 1; \ | 248 | 56 | { \ | 249 | 56 | kroundup32(new_n_buckets); \ | 250 | 56 | if (new_n_buckets < 4) new_n_buckets = 4; \ | 251 | 56 | if (h->size >= (khint_t)(new_n_buckets * __ac_HASH_UPPER + 0.5)) j = 00 ; /* requested size is too small */ \ | 252 | 56 | else { /* hash table size to be changed (shrink or expand); rehash */ \ | 253 | 56 | new_flags = (khint32_t*)kmalloc(__ac_fsize(new_n_buckets) * sizeof(khint32_t)); \ | 254 | 56 | if (!new_flags) return -10 ; \ | 255 | 56 | memset(new_flags, 0xaa, __ac_fsize(new_n_buckets) * sizeof(khint32_t)); \ | 256 | 56 | if (h->n_buckets < new_n_buckets) { /* expand */ \ | 257 | 56 | khkey_t *new_keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \ | 258 | 56 | if (!new_keys) { 0 kfree0 (new_flags); return -1; } \ | 259 | 56 | h->keys = new_keys; \ | 260 | 56 | if (kh_is_map) { \ | 261 | 56 | khval_t *new_vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \ | 262 | 56 | if (!new_vals) { 0 kfree0 (new_flags); return -1; } \ | 263 | 56 | h->vals = new_vals; \ | 264 | 56 | } \ | 265 | 56 | } /* otherwise shrink */ \ | 266 | 56 | } \ | 267 | 56 | } \ | 268 | 56 | if (j) { /* rehashing is needed */ \ | 269 | 56 | for (j = 0; j != h->n_buckets; ++j0 ) { \ | 270 | 0 | if (__ac_iseither(h->flags, j) == 0) { \ | 271 | 0 | khkey_t key = h->keys[j]; \ | 272 | 0 | khval_t val; \ | 273 | 0 | khint_t new_mask; \ | 274 | 0 | new_mask = new_n_buckets - 1; \ | 275 | 0 | if (kh_is_map) val = h->vals[j]; \ | 276 | 0 | __ac_set_isdel_true(h->flags, j); \ | 277 | 0 | while (1) { /* kick-out process; sort of like in Cuckoo hashing */ \ | 278 | 0 | khint_t k, i, step = 0; \ | 279 | 0 | k = __hash_func(key); \ | 280 | 0 | i = k & new_mask; \ | 281 | 0 | while (!__ac_isempty(new_flags, i)) i = (i + (++step)) & new_mask; \ | 282 | 0 | __ac_set_isempty_false(new_flags, i); \ | 283 | 0 | if (i < h->n_buckets && __ac_iseither(h->flags, i) == 0) { /* kick out the existing element */ \ | 284 | 0 | { khkey_t tmp = h->keys[i]; h->keys[i] = key; key = tmp; } \ | 285 | 0 | if (kh_is_map) { khval_t tmp = h->vals[i]; h->vals[i] = val; val = tmp; } \ | 286 | 0 | __ac_set_isdel_true(h->flags, i); /* mark it as deleted in the old hash table */ \ | 287 | 0 | } else { /* write the element and jump out of the loop */ \ | 288 | 0 | h->keys[i] = key; \ | 289 | 0 | if (kh_is_map) h->vals[i] = val; \ | 290 | 0 | break; \ | 291 | 0 | } \ | 292 | 0 | } \ | 293 | 0 | } \ | 294 | 0 | } \ | 295 | 56 | if (h->n_buckets > new_n_buckets) { /* shrink the hash table */ \ | 296 | 0 | h->keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \ | 297 | 0 | if (kh_is_map) h->vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \ | 298 | 0 | } \ | 299 | 56 | kfree(h->flags); /* free the working space */ \ | 300 | 56 | h->flags = new_flags; \ | 301 | 56 | h->n_buckets = new_n_buckets; \ | 302 | 56 | h->n_occupied = h->size; \ | 303 | 56 | h->upper_bound = (khint_t)(h->n_buckets * __ac_HASH_UPPER + 0.5); \ | 304 | 56 | } \ | 305 | 56 | return 0; \ | 306 | 56 | } \ |
ccv_cnnp_dataframe.c:kh_resize_iter_ctx Line | Count | Source | 245 | 4 | { /* This function uses 0.25*n_buckets bytes of working space instead of [sizeof(key_t+val_t)+.25]*n_buckets. */ \ | 246 | 4 | khint32_t *new_flags = 0; \ | 247 | 4 | khint_t j = 1; \ | 248 | 4 | { \ | 249 | 4 | kroundup32(new_n_buckets); \ | 250 | 4 | if (new_n_buckets < 4) new_n_buckets = 4; \ | 251 | 4 | if (h->size >= (khint_t)(new_n_buckets * __ac_HASH_UPPER + 0.5)) j = 00 ; /* requested size is too small */ \ | 252 | 4 | else { /* hash table size to be changed (shrink or expand); rehash */ \ | 253 | 4 | new_flags = (khint32_t*)kmalloc(__ac_fsize(new_n_buckets) * sizeof(khint32_t)); \ | 254 | 4 | if (!new_flags) return -10 ; \ | 255 | 4 | memset(new_flags, 0xaa, __ac_fsize(new_n_buckets) * sizeof(khint32_t)); \ | 256 | 4 | if (h->n_buckets < new_n_buckets) { /* expand */ \ | 257 | 4 | khkey_t *new_keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \ | 258 | 4 | if (!new_keys) { 0 kfree0 (new_flags); return -1; } \ | 259 | 4 | h->keys = new_keys; \ | 260 | 4 | if (kh_is_map) { \ | 261 | 4 | khval_t *new_vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \ | 262 | 4 | if (!new_vals) { 0 kfree0 (new_flags); return -1; } \ | 263 | 4 | h->vals = new_vals; \ | 264 | 4 | } \ | 265 | 4 | } /* otherwise shrink */ \ | 266 | 4 | } \ | 267 | 4 | } \ | 268 | 4 | if (j) { /* rehashing is needed */ \ | 269 | 4 | for (j = 0; j != h->n_buckets; ++j0 ) { \ | 270 | 0 | if (__ac_iseither(h->flags, j) == 0) { \ | 271 | 0 | khkey_t key = h->keys[j]; \ | 272 | 0 | khval_t val; \ | 273 | 0 | khint_t new_mask; \ | 274 | 0 | new_mask = new_n_buckets - 1; \ | 275 | 0 | if (kh_is_map) val = h->vals[j]; \ | 276 | 0 | __ac_set_isdel_true(h->flags, j); \ | 277 | 0 | while (1) { /* kick-out process; sort of like in Cuckoo hashing */ \ | 278 | 0 | khint_t k, i, step = 0; \ | 279 | 0 | k = __hash_func(key); \ | 280 | 0 | i = k & new_mask; \ | 281 | 0 | while (!__ac_isempty(new_flags, i)) i = (i + (++step)) & new_mask; \ | 282 | 0 | __ac_set_isempty_false(new_flags, i); \ | 283 | 0 | if (i < h->n_buckets && __ac_iseither(h->flags, i) == 0) { /* kick out the existing element */ \ | 284 | 0 | { khkey_t tmp = h->keys[i]; h->keys[i] = key; key = tmp; } \ | 285 | 0 | if (kh_is_map) { khval_t tmp = h->vals[i]; h->vals[i] = val; val = tmp; } \ | 286 | 0 | __ac_set_isdel_true(h->flags, i); /* mark it as deleted in the old hash table */ \ | 287 | 0 | } else { /* write the element and jump out of the loop */ \ | 288 | 0 | h->keys[i] = key; \ | 289 | 0 | if (kh_is_map) h->vals[i] = val; \ | 290 | 0 | break; \ | 291 | 0 | } \ | 292 | 0 | } \ | 293 | 0 | } \ | 294 | 0 | } \ | 295 | 4 | if (h->n_buckets > new_n_buckets) { /* shrink the hash table */ \ | 296 | 0 | h->keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \ | 297 | 0 | if (kh_is_map) h->vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \ | 298 | 0 | } \ | 299 | 4 | kfree(h->flags); /* free the working space */ \ | 300 | 4 | h->flags = new_flags; \ | 301 | 4 | h->n_buckets = new_n_buckets; \ | 302 | 4 | h->n_occupied = h->size; \ | 303 | 4 | h->upper_bound = (khint_t)(h->n_buckets * __ac_HASH_UPPER + 0.5); \ | 304 | 4 | } \ | 305 | 4 | return 0; \ | 306 | 4 | } \ |
ccv_cnnp_model.c:kh_resize_ccv_cnnp_model_name_bank Line | Count | Source | 245 | 1.23k | { /* This function uses 0.25*n_buckets bytes of working space instead of [sizeof(key_t+val_t)+.25]*n_buckets. */ \ | 246 | 1.23k | khint32_t *new_flags = 0; \ | 247 | 1.23k | khint_t j = 1; \ | 248 | 1.23k | { \ | 249 | 1.23k | kroundup32(new_n_buckets); \ | 250 | 1.23k | if (new_n_buckets < 4) new_n_buckets = 4; \ | 251 | 1.23k | if (h->size >= (khint_t)(new_n_buckets * __ac_HASH_UPPER + 0.5)) j = 00 ; /* requested size is too small */ \ | 252 | 1.23k | else { /* hash table size to be changed (shrink or expand); rehash */ \ | 253 | 1.23k | new_flags = (khint32_t*)kmalloc(__ac_fsize(new_n_buckets) * sizeof(khint32_t)); \ | 254 | 1.23k | if (!new_flags) return -10 ; \ | 255 | 1.23k | memset(new_flags, 0xaa, __ac_fsize(new_n_buckets) * sizeof(khint32_t)); \ | 256 | 1.23k | if (h->n_buckets < new_n_buckets) { /* expand */ \ | 257 | 1.23k | khkey_t *new_keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \ | 258 | 1.23k | if (!new_keys) { 0 kfree0 (new_flags); return -1; } \ | 259 | 1.23k | h->keys = new_keys; \ | 260 | 1.23k | if (kh_is_map) { \ | 261 | 1.23k | khval_t *new_vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \ | 262 | 1.23k | if (!new_vals) { 0 kfree0 (new_flags); return -1; } \ | 263 | 1.23k | h->vals = new_vals; \ | 264 | 1.23k | } \ | 265 | 1.23k | } /* otherwise shrink */ \ | 266 | 1.23k | } \ | 267 | 1.23k | } \ | 268 | 1.23k | if (j) { /* rehashing is needed */ \ | 269 | 1.23k | for (j = 0; j != h->n_buckets; ++j0 ) { \ | 270 | 0 | if (__ac_iseither(h->flags, j) == 0) { \ | 271 | 0 | khkey_t key = h->keys[j]; \ | 272 | 0 | khval_t val; \ | 273 | 0 | khint_t new_mask; \ | 274 | 0 | new_mask = new_n_buckets - 1; \ | 275 | 0 | if (kh_is_map) val = h->vals[j]; \ | 276 | 0 | __ac_set_isdel_true(h->flags, j); \ | 277 | 0 | while (1) { /* kick-out process; sort of like in Cuckoo hashing */ \ | 278 | 0 | khint_t k, i, step = 0; \ | 279 | 0 | k = __hash_func(key); \ | 280 | 0 | i = k & new_mask; \ | 281 | 0 | while (!__ac_isempty(new_flags, i)) i = (i + (++step)) & new_mask; \ | 282 | 0 | __ac_set_isempty_false(new_flags, i); \ | 283 | 0 | if (i < h->n_buckets && __ac_iseither(h->flags, i) == 0) { /* kick out the existing element */ \ | 284 | 0 | { khkey_t tmp = h->keys[i]; h->keys[i] = key; key = tmp; } \ | 285 | 0 | if (kh_is_map) { khval_t tmp = h->vals[i]; h->vals[i] = val; val = tmp; } \ | 286 | 0 | __ac_set_isdel_true(h->flags, i); /* mark it as deleted in the old hash table */ \ | 287 | 0 | } else { /* write the element and jump out of the loop */ \ | 288 | 0 | h->keys[i] = key; \ | 289 | 0 | if (kh_is_map) h->vals[i] = val; \ | 290 | 0 | break; \ | 291 | 0 | } \ | 292 | 0 | } \ | 293 | 0 | } \ | 294 | 0 | } \ | 295 | 1.23k | if (h->n_buckets > new_n_buckets) { /* shrink the hash table */ \ | 296 | 0 | h->keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \ | 297 | 0 | if (kh_is_map) h->vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \ | 298 | 0 | } \ | 299 | 1.23k | kfree(h->flags); /* free the working space */ \ | 300 | 1.23k | h->flags = new_flags; \ | 301 | 1.23k | h->n_buckets = new_n_buckets; \ | 302 | 1.23k | h->n_occupied = h->size; \ | 303 | 1.23k | h->upper_bound = (khint_t)(h->n_buckets * __ac_HASH_UPPER + 0.5); \ | 304 | 1.23k | } \ | 305 | 1.23k | return 0; \ | 306 | 1.23k | } \ |
ccv_cnnp_model.c:kh_resize_ccv_cnnp_parameter_id Line | Count | Source | 245 | 1 | { /* This function uses 0.25*n_buckets bytes of working space instead of [sizeof(key_t+val_t)+.25]*n_buckets. */ \ | 246 | 1 | khint32_t *new_flags = 0; \ | 247 | 1 | khint_t j = 1; \ | 248 | 1 | { \ | 249 | 1 | kroundup32(new_n_buckets); \ | 250 | 1 | if (new_n_buckets < 4) new_n_buckets = 4; \ | 251 | 1 | if (h->size >= (khint_t)(new_n_buckets * __ac_HASH_UPPER + 0.5)) j = 00 ; /* requested size is too small */ \ | 252 | 1 | else { /* hash table size to be changed (shrink or expand); rehash */ \ | 253 | 1 | new_flags = (khint32_t*)kmalloc(__ac_fsize(new_n_buckets) * sizeof(khint32_t)); \ | 254 | 1 | if (!new_flags) return -10 ; \ | 255 | 1 | memset(new_flags, 0xaa, __ac_fsize(new_n_buckets) * sizeof(khint32_t)); \ | 256 | 1 | if (h->n_buckets < new_n_buckets) { /* expand */ \ | 257 | 1 | khkey_t *new_keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \ | 258 | 1 | if (!new_keys) { 0 kfree0 (new_flags); return -1; } \ | 259 | 1 | h->keys = new_keys; \ | 260 | 1 | if (kh_is_map) { \ | 261 | 1 | khval_t *new_vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \ | 262 | 1 | if (!new_vals) { 0 kfree0 (new_flags); return -1; } \ | 263 | 1 | h->vals = new_vals; \ | 264 | 1 | } \ | 265 | 1 | } /* otherwise shrink */ \ | 266 | 1 | } \ | 267 | 1 | } \ | 268 | 1 | if (j) { /* rehashing is needed */ \ | 269 | 1 | for (j = 0; j != h->n_buckets; ++j0 ) { \ | 270 | 0 | if (__ac_iseither(h->flags, j) == 0) { \ | 271 | 0 | khkey_t key = h->keys[j]; \ | 272 | 0 | khval_t val; \ | 273 | 0 | khint_t new_mask; \ | 274 | 0 | new_mask = new_n_buckets - 1; \ | 275 | 0 | if (kh_is_map) val = h->vals[j]; \ | 276 | 0 | __ac_set_isdel_true(h->flags, j); \ | 277 | 0 | while (1) { /* kick-out process; sort of like in Cuckoo hashing */ \ | 278 | 0 | khint_t k, i, step = 0; \ | 279 | 0 | k = __hash_func(key); \ | 280 | 0 | i = k & new_mask; \ | 281 | 0 | while (!__ac_isempty(new_flags, i)) i = (i + (++step)) & new_mask; \ | 282 | 0 | __ac_set_isempty_false(new_flags, i); \ | 283 | 0 | if (i < h->n_buckets && __ac_iseither(h->flags, i) == 0) { /* kick out the existing element */ \ | 284 | 0 | { khkey_t tmp = h->keys[i]; h->keys[i] = key; key = tmp; } \ | 285 | 0 | if (kh_is_map) { khval_t tmp = h->vals[i]; h->vals[i] = val; val = tmp; } \ | 286 | 0 | __ac_set_isdel_true(h->flags, i); /* mark it as deleted in the old hash table */ \ | 287 | 0 | } else { /* write the element and jump out of the loop */ \ | 288 | 0 | h->keys[i] = key; \ | 289 | 0 | if (kh_is_map) h->vals[i] = val; \ | 290 | 0 | break; \ | 291 | 0 | } \ | 292 | 0 | } \ | 293 | 0 | } \ | 294 | 0 | } \ | 295 | 1 | if (h->n_buckets > new_n_buckets) { /* shrink the hash table */ \ | 296 | 0 | h->keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \ | 297 | 0 | if (kh_is_map) h->vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \ | 298 | 0 | } \ | 299 | 1 | kfree(h->flags); /* free the working space */ \ | 300 | 1 | h->flags = new_flags; \ | 301 | 1 | h->n_buckets = new_n_buckets; \ | 302 | 1 | h->n_occupied = h->size; \ | 303 | 1 | h->upper_bound = (khint_t)(h->n_buckets * __ac_HASH_UPPER + 0.5); \ | 304 | 1 | } \ | 305 | 1 | return 0; \ | 306 | 1 | } \ |
ccv_cnnp_model.c:kh_resize_stream_map Line | Count | Source | 245 | 8 | { /* This function uses 0.25*n_buckets bytes of working space instead of [sizeof(key_t+val_t)+.25]*n_buckets. */ \ | 246 | 8 | khint32_t *new_flags = 0; \ | 247 | 8 | khint_t j = 1; \ | 248 | 8 | { \ | 249 | 8 | kroundup32(new_n_buckets); \ | 250 | 8 | if (new_n_buckets < 4) new_n_buckets = 44 ; \ | 251 | 8 | if (h->size >= (khint_t)(new_n_buckets * __ac_HASH_UPPER + 0.5)) j = 00 ; /* requested size is too small */ \ | 252 | 8 | else { /* hash table size to be changed (shrink or expand); rehash */ \ | 253 | 8 | new_flags = (khint32_t*)kmalloc(__ac_fsize(new_n_buckets) * sizeof(khint32_t)); \ | 254 | 8 | if (!new_flags) return -10 ; \ | 255 | 8 | memset(new_flags, 0xaa, __ac_fsize(new_n_buckets) * sizeof(khint32_t)); \ | 256 | 8 | if (h->n_buckets < new_n_buckets) { /* expand */ \ | 257 | 8 | khkey_t *new_keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \ | 258 | 8 | if (!new_keys) { 0 kfree0 (new_flags); return -1; } \ | 259 | 8 | h->keys = new_keys; \ | 260 | 8 | if (kh_is_map) { \ | 261 | 8 | khval_t *new_vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \ | 262 | 8 | if (!new_vals) { 0 kfree0 (new_flags); return -1; } \ | 263 | 8 | h->vals = new_vals; \ | 264 | 8 | } \ | 265 | 8 | } /* otherwise shrink */ \ | 266 | 8 | } \ | 267 | 8 | } \ | 268 | 8 | if (j) { /* rehashing is needed */ \ | 269 | 24 | for (j = 0; j != h->n_buckets; ++j16 ) { \ | 270 | 16 | if (__ac_iseither(h->flags, j) == 0) { \ | 271 | 4 | khkey_t key = h->keys[j]; \ | 272 | 4 | khval_t val; \ | 273 | 4 | khint_t new_mask; \ | 274 | 4 | new_mask = new_n_buckets - 1; \ | 275 | 4 | if (kh_is_map) val = h->vals[j]; \ | 276 | 4 | __ac_set_isdel_true(h->flags, j); \ | 277 | 12 | while (1) { /* kick-out process; sort of like in Cuckoo hashing */ \ | 278 | 12 | khint_t k, i, step = 0; \ | 279 | 12 | k = __hash_func(key); \ | 280 | 12 | i = k & new_mask; \ | 281 | 24 | while (!__ac_isempty(new_flags, i)) i = (i + (++step)) & new_mask12 ; \ | 282 | 12 | __ac_set_isempty_false(new_flags, i); \ | 283 | 12 | if (i < h->n_buckets && __ac_iseither8 (h->flags, i) == 08 ) { /* kick out the existing element */ \ | 284 | 8 | { khkey_t tmp = h->keys[i]; h->keys[i] = key; key = tmp; } \ | 285 | 8 | if (kh_is_map) { khval_t tmp = h->vals[i]; h->vals[i] = val; val = tmp; } \ | 286 | 8 | __ac_set_isdel_true(h->flags, i); /* mark it as deleted in the old hash table */ \ | 287 | 8 | } else { /* write the element and jump out of the loop */ \ | 288 | 4 | h->keys[i] = key; \ | 289 | 4 | if (kh_is_map) h->vals[i] = val; \ | 290 | 4 | break; \ | 291 | 4 | } \ | 292 | 12 | } \ | 293 | 4 | } \ | 294 | 16 | } \ | 295 | 8 | if (h->n_buckets > new_n_buckets) { /* shrink the hash table */ \ | 296 | 0 | h->keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \ | 297 | 0 | if (kh_is_map) h->vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \ | 298 | 0 | } \ | 299 | 8 | kfree(h->flags); /* free the working space */ \ | 300 | 8 | h->flags = new_flags; \ | 301 | 8 | h->n_buckets = new_n_buckets; \ | 302 | 8 | h->n_occupied = h->size; \ | 303 | 8 | h->upper_bound = (khint_t)(h->n_buckets * __ac_HASH_UPPER + 0.5); \ | 304 | 8 | } \ | 305 | 8 | return 0; \ | 306 | 8 | } \ |
Unexecuted instantiation: ccv_cnnp_model.c:kh_resize_dy_dev Unexecuted instantiation: ccv_cnnp_model.c:kh_resize_dy_str Unexecuted instantiation: ccv_cnnp_model.c:kh_resize_dy_alloc Unexecuted instantiation: ccv_cnnp_model_io.c:kh_resize_stream_map Unexecuted instantiation: ccv_cnnp_model_io.c:kh_resize_dy_dev Unexecuted instantiation: ccv_cnnp_model_io.c:kh_resize_dy_str Unexecuted instantiation: ccv_cnnp_model_io.c:kh_resize_dy_alloc Unexecuted instantiation: ccv_cnnp_model_io.c:kh_resize_ccv_cnnp_model_name_bank ccv_cnnp_model_core.c:kh_resize_ccv_cnnp_model_name_bank Line | Count | Source | 245 | 1.11k | { /* This function uses 0.25*n_buckets bytes of working space instead of [sizeof(key_t+val_t)+.25]*n_buckets. */ \ | 246 | 1.11k | khint32_t *new_flags = 0; \ | 247 | 1.11k | khint_t j = 1; \ | 248 | 1.11k | { \ | 249 | 1.11k | kroundup32(new_n_buckets); \ | 250 | 1.11k | if (new_n_buckets < 4) new_n_buckets = 41.09k ; \ | 251 | 1.11k | if (h->size >= (khint_t)(new_n_buckets * __ac_HASH_UPPER + 0.5)) j = 00 ; /* requested size is too small */ \ | 252 | 1.11k | else { /* hash table size to be changed (shrink or expand); rehash */ \ | 253 | 1.11k | new_flags = (khint32_t*)kmalloc(__ac_fsize(new_n_buckets) * sizeof(khint32_t)); \ | 254 | 1.11k | if (!new_flags) return -10 ; \ | 255 | 1.11k | memset(new_flags, 0xaa, __ac_fsize(new_n_buckets) * sizeof(khint32_t)); \ | 256 | 1.11k | if (h->n_buckets < new_n_buckets) { /* expand */ \ | 257 | 1.11k | khkey_t *new_keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \ | 258 | 1.11k | if (!new_keys) { 0 kfree0 (new_flags); return -1; } \ | 259 | 1.11k | h->keys = new_keys; \ | 260 | 1.11k | if (kh_is_map) { \ | 261 | 1.11k | khval_t *new_vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \ | 262 | 1.11k | if (!new_vals) { 0 kfree0 (new_flags); return -1; } \ | 263 | 1.11k | h->vals = new_vals; \ | 264 | 1.11k | } \ | 265 | 1.11k | } /* otherwise shrink */ \ | 266 | 1.11k | } \ | 267 | 1.11k | } \ | 268 | 1.11k | if (j) { /* rehashing is needed */ \ | 269 | 1.23k | for (j = 0; j != h->n_buckets; ++j124 ) { \ | 270 | 124 | if (__ac_iseither(h->flags, j) == 0) { \ | 271 | 89 | khkey_t key = h->keys[j]; \ | 272 | 89 | khval_t val; \ | 273 | 89 | khint_t new_mask; \ | 274 | 89 | new_mask = new_n_buckets - 1; \ | 275 | 89 | if (kh_is_map) val = h->vals[j]; \ | 276 | 89 | __ac_set_isdel_true(h->flags, j); \ | 277 | 93 | while (1) { /* kick-out process; sort of like in Cuckoo hashing */ \ | 278 | 93 | khint_t k, i, step = 0; \ | 279 | 93 | k = __hash_func(key); \ | 280 | 93 | i = k & new_mask; \ | 281 | 97 | while (!__ac_isempty(new_flags, i)) i = (i + (++step)) & new_mask4 ; \ | 282 | 93 | __ac_set_isempty_false(new_flags, i); \ | 283 | 93 | if (i < h->n_buckets && __ac_iseither42 (h->flags, i) == 042 ) { /* kick out the existing element */ \ | 284 | 4 | { khkey_t tmp = h->keys[i]; h->keys[i] = key; key = tmp; } \ | 285 | 4 | if (kh_is_map) { khval_t tmp = h->vals[i]; h->vals[i] = val; val = tmp; } \ | 286 | 4 | __ac_set_isdel_true(h->flags, i); /* mark it as deleted in the old hash table */ \ | 287 | 89 | } else { /* write the element and jump out of the loop */ \ | 288 | 89 | h->keys[i] = key; \ | 289 | 89 | if (kh_is_map) h->vals[i] = val; \ | 290 | 89 | break; \ | 291 | 89 | } \ | 292 | 93 | } \ | 293 | 89 | } \ | 294 | 124 | } \ | 295 | 1.11k | if (h->n_buckets > new_n_buckets) { /* shrink the hash table */ \ | 296 | 0 | h->keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \ | 297 | 0 | if (kh_is_map) h->vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \ | 298 | 0 | } \ | 299 | 1.11k | kfree(h->flags); /* free the working space */ \ | 300 | 1.11k | h->flags = new_flags; \ | 301 | 1.11k | h->n_buckets = new_n_buckets; \ | 302 | 1.11k | h->n_occupied = h->size; \ | 303 | 1.11k | h->upper_bound = (khint_t)(h->n_buckets * __ac_HASH_UPPER + 0.5); \ | 304 | 1.11k | } \ | 305 | 1.11k | return 0; \ | 306 | 1.11k | } \ |
ccv_cnnp_model_core.c:kh_resize_model Line | Count | Source | 245 | 1.02k | { /* This function uses 0.25*n_buckets bytes of working space instead of [sizeof(key_t+val_t)+.25]*n_buckets. */ \ | 246 | 1.02k | khint32_t *new_flags = 0; \ | 247 | 1.02k | khint_t j = 1; \ | 248 | 1.02k | { \ | 249 | 1.02k | kroundup32(new_n_buckets); \ | 250 | 1.02k | if (new_n_buckets < 4) new_n_buckets = 41.00k ; \ | 251 | 1.02k | if (h->size >= (khint_t)(new_n_buckets * __ac_HASH_UPPER + 0.5)) j = 00 ; /* requested size is too small */ \ | 252 | 1.02k | else { /* hash table size to be changed (shrink or expand); rehash */ \ | 253 | 1.02k | new_flags = (khint32_t*)kmalloc(__ac_fsize(new_n_buckets) * sizeof(khint32_t)); \ | 254 | 1.02k | if (!new_flags) return -10 ; \ | 255 | 1.02k | memset(new_flags, 0xaa, __ac_fsize(new_n_buckets) * sizeof(khint32_t)); \ | 256 | 1.02k | if (h->n_buckets < new_n_buckets) { /* expand */ \ | 257 | 1.02k | khkey_t *new_keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \ | 258 | 1.02k | if (!new_keys) { 0 kfree0 (new_flags); return -1; } \ | 259 | 1.02k | h->keys = new_keys; \ | 260 | 1.02k | if (kh_is_map) { \ | 261 | 1.02k | khval_t *new_vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \ | 262 | 1.02k | if (!new_vals) { 0 kfree0 (new_flags); return -1; } \ | 263 | 1.02k | h->vals = new_vals; \ | 264 | 1.02k | } \ | 265 | 1.02k | } /* otherwise shrink */ \ | 266 | 1.02k | } \ | 267 | 1.02k | } \ | 268 | 1.02k | if (j) { /* rehashing is needed */ \ | 269 | 1.17k | for (j = 0; j != h->n_buckets; ++j148 ) { \ | 270 | 148 | if (__ac_iseither(h->flags, j) == 0) { \ | 271 | 97 | khkey_t key = h->keys[j]; \ | 272 | 97 | khval_t val; \ | 273 | 97 | khint_t new_mask; \ | 274 | 97 | new_mask = new_n_buckets - 1; \ | 275 | 97 | if (kh_is_map) val = h->vals[j]; \ | 276 | 97 | __ac_set_isdel_true(h->flags, j); \ | 277 | 112 | while (1) { /* kick-out process; sort of like in Cuckoo hashing */ \ | 278 | 112 | khint_t k, i, step = 0; \ | 279 | 112 | k = __hash_func(key); \ | 280 | 112 | i = k & new_mask; \ | 281 | 441 | while (!__ac_isempty(new_flags, i)) i = (i + (++step)) & new_mask329 ; \ | 282 | 112 | __ac_set_isempty_false(new_flags, i); \ | 283 | 112 | if (i < h->n_buckets && __ac_iseither62 (h->flags, i) == 062 ) { /* kick out the existing element */ \ | 284 | 15 | { khkey_t tmp = h->keys[i]; h->keys[i] = key; key = tmp; } \ | 285 | 15 | if (kh_is_map) { khval_t tmp = h->vals[i]; h->vals[i] = val; val = tmp; } \ | 286 | 15 | __ac_set_isdel_true(h->flags, i); /* mark it as deleted in the old hash table */ \ | 287 | 97 | } else { /* write the element and jump out of the loop */ \ | 288 | 97 | h->keys[i] = key; \ | 289 | 97 | if (kh_is_map) h->vals[i] = val; \ | 290 | 97 | break; \ | 291 | 97 | } \ | 292 | 112 | } \ | 293 | 97 | } \ | 294 | 148 | } \ | 295 | 1.02k | if (h->n_buckets > new_n_buckets) { /* shrink the hash table */ \ | 296 | 0 | h->keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \ | 297 | 0 | if (kh_is_map) h->vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \ | 298 | 0 | } \ | 299 | 1.02k | kfree(h->flags); /* free the working space */ \ | 300 | 1.02k | h->flags = new_flags; \ | 301 | 1.02k | h->n_buckets = new_n_buckets; \ | 302 | 1.02k | h->n_occupied = h->size; \ | 303 | 1.02k | h->upper_bound = (khint_t)(h->n_buckets * __ac_HASH_UPPER + 0.5); \ | 304 | 1.02k | } \ | 305 | 1.02k | return 0; \ | 306 | 1.02k | } \ |
ccv_cnnp_model_core.c:kh_resize_io_node Line | Count | Source | 245 | 2 | { /* This function uses 0.25*n_buckets bytes of working space instead of [sizeof(key_t+val_t)+.25]*n_buckets. */ \ | 246 | 2 | khint32_t *new_flags = 0; \ | 247 | 2 | khint_t j = 1; \ | 248 | 2 | { \ | 249 | 2 | kroundup32(new_n_buckets); \ | 250 | 2 | if (new_n_buckets < 4) new_n_buckets = 4; \ | 251 | 2 | if (h->size >= (khint_t)(new_n_buckets * __ac_HASH_UPPER + 0.5)) j = 00 ; /* requested size is too small */ \ | 252 | 2 | else { /* hash table size to be changed (shrink or expand); rehash */ \ | 253 | 2 | new_flags = (khint32_t*)kmalloc(__ac_fsize(new_n_buckets) * sizeof(khint32_t)); \ | 254 | 2 | if (!new_flags) return -10 ; \ | 255 | 2 | memset(new_flags, 0xaa, __ac_fsize(new_n_buckets) * sizeof(khint32_t)); \ | 256 | 2 | if (h->n_buckets < new_n_buckets) { /* expand */ \ | 257 | 2 | khkey_t *new_keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \ | 258 | 2 | if (!new_keys) { 0 kfree0 (new_flags); return -1; } \ | 259 | 2 | h->keys = new_keys; \ | 260 | 2 | if (kh_is_map) { \ | 261 | 2 | khval_t *new_vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \ | 262 | 2 | if (!new_vals) { 0 kfree0 (new_flags); return -1; } \ | 263 | 2 | h->vals = new_vals; \ | 264 | 2 | } \ | 265 | 2 | } /* otherwise shrink */ \ | 266 | 2 | } \ | 267 | 2 | } \ | 268 | 2 | if (j) { /* rehashing is needed */ \ | 269 | 2 | for (j = 0; j != h->n_buckets; ++j0 ) { \ | 270 | 0 | if (__ac_iseither(h->flags, j) == 0) { \ | 271 | 0 | khkey_t key = h->keys[j]; \ | 272 | 0 | khval_t val; \ | 273 | 0 | khint_t new_mask; \ | 274 | 0 | new_mask = new_n_buckets - 1; \ | 275 | 0 | if (kh_is_map) val = h->vals[j]; \ | 276 | 0 | __ac_set_isdel_true(h->flags, j); \ | 277 | 0 | while (1) { /* kick-out process; sort of like in Cuckoo hashing */ \ | 278 | 0 | khint_t k, i, step = 0; \ | 279 | 0 | k = __hash_func(key); \ | 280 | 0 | i = k & new_mask; \ | 281 | 0 | while (!__ac_isempty(new_flags, i)) i = (i + (++step)) & new_mask; \ | 282 | 0 | __ac_set_isempty_false(new_flags, i); \ | 283 | 0 | if (i < h->n_buckets && __ac_iseither(h->flags, i) == 0) { /* kick out the existing element */ \ | 284 | 0 | { khkey_t tmp = h->keys[i]; h->keys[i] = key; key = tmp; } \ | 285 | 0 | if (kh_is_map) { khval_t tmp = h->vals[i]; h->vals[i] = val; val = tmp; } \ | 286 | 0 | __ac_set_isdel_true(h->flags, i); /* mark it as deleted in the old hash table */ \ | 287 | 0 | } else { /* write the element and jump out of the loop */ \ | 288 | 0 | h->keys[i] = key; \ | 289 | 0 | if (kh_is_map) h->vals[i] = val; \ | 290 | 0 | break; \ | 291 | 0 | } \ | 292 | 0 | } \ | 293 | 0 | } \ | 294 | 0 | } \ | 295 | 2 | if (h->n_buckets > new_n_buckets) { /* shrink the hash table */ \ | 296 | 0 | h->keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \ | 297 | 0 | if (kh_is_map) h->vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \ | 298 | 0 | } \ | 299 | 2 | kfree(h->flags); /* free the working space */ \ | 300 | 2 | h->flags = new_flags; \ | 301 | 2 | h->n_buckets = new_n_buckets; \ | 302 | 2 | h->n_occupied = h->size; \ | 303 | 2 | h->upper_bound = (khint_t)(h->n_buckets * __ac_HASH_UPPER + 0.5); \ | 304 | 2 | } \ | 305 | 2 | return 0; \ | 306 | 2 | } \ |
ccv_cnnp_model_core.c:kh_resize_model_io Line | Count | Source | 245 | 18 | { /* This function uses 0.25*n_buckets bytes of working space instead of [sizeof(key_t+val_t)+.25]*n_buckets. */ \ | 246 | 18 | khint32_t *new_flags = 0; \ | 247 | 18 | khint_t j = 1; \ | 248 | 18 | { \ | 249 | 18 | kroundup32(new_n_buckets); \ | 250 | 18 | if (new_n_buckets < 4) new_n_buckets = 48 ; \ | 251 | 18 | if (h->size >= (khint_t)(new_n_buckets * __ac_HASH_UPPER + 0.5)) j = 00 ; /* requested size is too small */ \ | 252 | 18 | else { /* hash table size to be changed (shrink or expand); rehash */ \ | 253 | 18 | new_flags = (khint32_t*)kmalloc(__ac_fsize(new_n_buckets) * sizeof(khint32_t)); \ | 254 | 18 | if (!new_flags) return -10 ; \ | 255 | 18 | memset(new_flags, 0xaa, __ac_fsize(new_n_buckets) * sizeof(khint32_t)); \ | 256 | 18 | if (h->n_buckets < new_n_buckets) { /* expand */ \ | 257 | 18 | khkey_t *new_keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \ | 258 | 18 | if (!new_keys) { 0 kfree0 (new_flags); return -1; } \ | 259 | 18 | h->keys = new_keys; \ | 260 | 18 | if (kh_is_map) { \ | 261 | 18 | khval_t *new_vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \ | 262 | 18 | if (!new_vals) { 0 kfree0 (new_flags); return -1; } \ | 263 | 18 | h->vals = new_vals; \ | 264 | 18 | } \ | 265 | 18 | } /* otherwise shrink */ \ | 266 | 18 | } \ | 267 | 18 | } \ | 268 | 18 | if (j) { /* rehashing is needed */ \ | 269 | 78 | for (j = 0; j != h->n_buckets; ++j60 ) { \ | 270 | 60 | if (__ac_iseither(h->flags, j) == 0) { \ | 271 | 41 | khkey_t key = h->keys[j]; \ | 272 | 41 | khval_t val; \ | 273 | 41 | khint_t new_mask; \ | 274 | 41 | new_mask = new_n_buckets - 1; \ | 275 | 41 | if (kh_is_map) val = h->vals[j]; \ | 276 | 41 | __ac_set_isdel_true(h->flags, j); \ | 277 | 45 | while (1) { /* kick-out process; sort of like in Cuckoo hashing */ \ | 278 | 45 | khint_t k, i, step = 0; \ | 279 | 45 | k = __hash_func(key); \ | 280 | 45 | i = k & new_mask; \ | 281 | 127 | while (!__ac_isempty(new_flags, i)) i = (i + (++step)) & new_mask82 ; \ | 282 | 45 | __ac_set_isempty_false(new_flags, i); \ | 283 | 45 | if (i < h->n_buckets && __ac_iseither30 (h->flags, i) == 030 ) { /* kick out the existing element */ \ | 284 | 4 | { khkey_t tmp = h->keys[i]; h->keys[i] = key; key = tmp; } \ | 285 | 4 | if (kh_is_map) { khval_t tmp = h->vals[i]; h->vals[i] = val; val = tmp; } \ | 286 | 4 | __ac_set_isdel_true(h->flags, i); /* mark it as deleted in the old hash table */ \ | 287 | 41 | } else { /* write the element and jump out of the loop */ \ | 288 | 41 | h->keys[i] = key; \ | 289 | 41 | if (kh_is_map) h->vals[i] = val; \ | 290 | 41 | break; \ | 291 | 41 | } \ | 292 | 45 | } \ | 293 | 41 | } \ | 294 | 60 | } \ | 295 | 18 | if (h->n_buckets > new_n_buckets) { /* shrink the hash table */ \ | 296 | 0 | h->keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \ | 297 | 0 | if (kh_is_map) h->vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \ | 298 | 0 | } \ | 299 | 18 | kfree(h->flags); /* free the working space */ \ | 300 | 18 | h->flags = new_flags; \ | 301 | 18 | h->n_buckets = new_n_buckets; \ | 302 | 18 | h->n_occupied = h->size; \ | 303 | 18 | h->upper_bound = (khint_t)(h->n_buckets * __ac_HASH_UPPER + 0.5); \ | 304 | 18 | } \ | 305 | 18 | return 0; \ | 306 | 18 | } \ |
Unexecuted instantiation: ccv_cnnp_model_core.c:kh_resize_stream_map Unexecuted instantiation: ccv_cnnp_model_core.c:kh_resize_dy_dev Unexecuted instantiation: ccv_cnnp_model_core.c:kh_resize_dy_str Unexecuted instantiation: ccv_cnnp_model_core.c:kh_resize_dy_alloc Unexecuted instantiation: ccv_cnnp_model_addons.c:kh_resize_stream_map Unexecuted instantiation: ccv_cnnp_model_addons.c:kh_resize_dy_dev Unexecuted instantiation: ccv_cnnp_model_addons.c:kh_resize_dy_str Unexecuted instantiation: ccv_cnnp_model_addons.c:kh_resize_dy_alloc Unexecuted instantiation: ccv_cnnp_model_addons.c:kh_resize_ccv_cnnp_model_name_bank Unexecuted instantiation: ccv_nnc_palettize.c:kh_resize_stream_map ccv_cnnp_model_gradient_checkpointing.c:kh_resize_ccv_cnnp_tensor_symbol_map Line | Count | Source | 245 | 5 | { /* This function uses 0.25*n_buckets bytes of working space instead of [sizeof(key_t+val_t)+.25]*n_buckets. */ \ | 246 | 5 | khint32_t *new_flags = 0; \ | 247 | 5 | khint_t j = 1; \ | 248 | 5 | { \ | 249 | 5 | kroundup32(new_n_buckets); \ | 250 | 5 | if (new_n_buckets < 4) new_n_buckets = 42 ; \ | 251 | 5 | if (h->size >= (khint_t)(new_n_buckets * __ac_HASH_UPPER + 0.5)) j = 00 ; /* requested size is too small */ \ | 252 | 5 | else { /* hash table size to be changed (shrink or expand); rehash */ \ | 253 | 5 | new_flags = (khint32_t*)kmalloc(__ac_fsize(new_n_buckets) * sizeof(khint32_t)); \ | 254 | 5 | if (!new_flags) return -10 ; \ | 255 | 5 | memset(new_flags, 0xaa, __ac_fsize(new_n_buckets) * sizeof(khint32_t)); \ | 256 | 5 | if (h->n_buckets < new_n_buckets) { /* expand */ \ | 257 | 5 | khkey_t *new_keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \ | 258 | 5 | if (!new_keys) { 0 kfree0 (new_flags); return -1; } \ | 259 | 5 | h->keys = new_keys; \ | 260 | 5 | if (kh_is_map) { \ | 261 | 5 | khval_t *new_vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \ | 262 | 5 | if (!new_vals) { 0 kfree0 (new_flags); return -1; } \ | 263 | 5 | h->vals = new_vals; \ | 264 | 5 | } \ | 265 | 5 | } /* otherwise shrink */ \ | 266 | 5 | } \ | 267 | 5 | } \ | 268 | 5 | if (j) { /* rehashing is needed */ \ | 269 | 33 | for (j = 0; j != h->n_buckets; ++j28 ) { \ | 270 | 28 | if (__ac_iseither(h->flags, j) == 0) { \ | 271 | 21 | khkey_t key = h->keys[j]; \ | 272 | 21 | khval_t val; \ | 273 | 21 | khint_t new_mask; \ | 274 | 21 | new_mask = new_n_buckets - 1; \ | 275 | 21 | if (kh_is_map) val = h->vals[j]; \ | 276 | 21 | __ac_set_isdel_true(h->flags, j); \ | 277 | 21 | while (1) { /* kick-out process; sort of like in Cuckoo hashing */ \ | 278 | 21 | khint_t k, i, step = 0; \ | 279 | 21 | k = __hash_func(key); \ | 280 | 21 | i = k & new_mask; \ | 281 | 21 | while (!__ac_isempty(new_flags, i)) i = (i + (++step)) & new_mask0 ; \ | 282 | 21 | __ac_set_isempty_false(new_flags, i); \ | 283 | 21 | if (i < h->n_buckets && __ac_iseither13 (h->flags, i) == 013 ) { /* kick out the existing element */ \ | 284 | 0 | { khkey_t tmp = h->keys[i]; h->keys[i] = key; key = tmp; } \ | 285 | 0 | if (kh_is_map) { khval_t tmp = h->vals[i]; h->vals[i] = val; val = tmp; } \ | 286 | 0 | __ac_set_isdel_true(h->flags, i); /* mark it as deleted in the old hash table */ \ | 287 | 21 | } else { /* write the element and jump out of the loop */ \ | 288 | 21 | h->keys[i] = key; \ | 289 | 21 | if (kh_is_map) h->vals[i] = val; \ | 290 | 21 | break; \ | 291 | 21 | } \ | 292 | 21 | } \ | 293 | 21 | } \ | 294 | 28 | } \ | 295 | 5 | if (h->n_buckets > new_n_buckets) { /* shrink the hash table */ \ | 296 | 0 | h->keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \ | 297 | 0 | if (kh_is_map) h->vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \ | 298 | 0 | } \ | 299 | 5 | kfree(h->flags); /* free the working space */ \ | 300 | 5 | h->flags = new_flags; \ | 301 | 5 | h->n_buckets = new_n_buckets; \ | 302 | 5 | h->n_occupied = h->size; \ | 303 | 5 | h->upper_bound = (khint_t)(h->n_buckets * __ac_HASH_UPPER + 0.5); \ | 304 | 5 | } \ | 305 | 5 | return 0; \ | 306 | 5 | } \ |
Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:kh_resize_stream_map Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:kh_resize_dy_dev Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:kh_resize_dy_str Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:kh_resize_dy_alloc Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:kh_resize_ccv_cnnp_model_name_bank |
307 | | SCOPE khint_t kh_put_##name(kh_##name##_t *h, khkey_t key, int *ret) \ |
308 | 458k | { \ |
309 | 458k | khint_t x; \ |
310 | 458k | if (h->n_occupied >= h->upper_bound) { /* update the hash table */ \ |
311 | 3.71k | if (h->n_buckets > (h->size<<1)) { \ |
312 | 102 | if (kh_resize_##name(h, h->n_buckets - 1) < 0) { /* clear "deleted" elements */ \ |
313 | 0 | *ret = -1; return h->n_buckets; \ |
314 | 0 | } \ |
315 | 3.60k | } else if (kh_resize_##name(h, h->n_buckets + 1) < 0) { /* expand the hash table */ \ |
316 | 0 | *ret = -1; return h->n_buckets; \ |
317 | 0 | } \ |
318 | 3.71k | } /* TODO: to implement automatically shrinking; resize() already support shrinking */ \ |
319 | 458k | { \ |
320 | 458k | khint_t k, i, site, last, mask = h->n_buckets - 1, step = 0; \ |
321 | 458k | x = site = h->n_buckets; k = __hash_func(key); i = k & mask; \ |
322 | 458k | if (__ac_isempty(h->flags, i)) x = i120k ; /* for speed up */ \ |
323 | 458k | else { \ |
324 | 338k | last = i; \ |
325 | 990k | while (!__ac_isempty(h->flags, i) && (836k __ac_isdel836k (h->flags, i) || !835k __hash_equal835k (h->keys[i], key))) { \ |
326 | 652k | if (__ac_isdel(h->flags, i)) site = i1.20k ; \ |
327 | 652k | i = (i + (++step)) & mask; \ |
328 | 652k | if (i == last) { x = site; break; }0 \ |
329 | 652k | } \ |
330 | 338k | if (x == h->n_buckets) { \ |
331 | 338k | if (__ac_isempty(h->flags, i) && site != h->n_buckets153k ) x = site160 ; \ |
332 | 338k | else x = i337k ; \ |
333 | 338k | } \ |
334 | 338k | } \ |
335 | 458k | } \ |
336 | 458k | if (__ac_isempty(h->flags, x)) { /* not present at all */ \ |
337 | 273k | h->keys[x] = key; \ |
338 | 273k | __ac_set_isboth_false(h->flags, x); \ |
339 | 273k | ++h->size; ++h->n_occupied; \ |
340 | 273k | *ret = 1; \ |
341 | 273k | } else if (184k __ac_isdel184k (h->flags, x)) { /* deleted */ \ |
342 | 160 | h->keys[x] = key; \ |
343 | 160 | __ac_set_isboth_false(h->flags, x); \ |
344 | 160 | ++h->size; \ |
345 | 160 | *ret = 2; \ |
346 | 184k | } else *ret = 0; /* Don't touch h->keys[x] if present and not deleted */ \ |
347 | 458k | return x; \ |
348 | 458k | } \ Unexecuted instantiation: while.backward.tests.c:kh_put_stream_map Unexecuted instantiation: tape.tests.c:kh_put_stream_map imdb.tests.c:kh_put_vocab_map Line | Count | Source | 308 | 268k | { \ | 309 | 268k | khint_t x; \ | 310 | 268k | if (h->n_occupied >= h->upper_bound) { /* update the hash table */ \ | 311 | 48 | if (h->n_buckets > (h->size<<1)) { \ | 312 | 0 | if (kh_resize_##name(h, h->n_buckets - 1) < 0) { /* clear "deleted" elements */ \ | 313 | 0 | *ret = -1; return h->n_buckets; \ | 314 | 0 | } \ | 315 | 48 | } else if (kh_resize_##name(h, h->n_buckets + 1) < 0) { /* expand the hash table */ \ | 316 | 0 | *ret = -1; return h->n_buckets; \ | 317 | 0 | } \ | 318 | 48 | } /* TODO: to implement automatically shrinking; resize() already support shrinking */ \ | 319 | 268k | { \ | 320 | 268k | khint_t k, i, site, last, mask = h->n_buckets - 1, step = 0; \ | 321 | 268k | x = site = h->n_buckets; k = __hash_func(key); i = k & mask; \ | 322 | 268k | if (__ac_isempty(h->flags, i)) x = i116k ; /* for speed up */ \ | 323 | 268k | else { \ | 324 | 151k | last = i; \ | 325 | 720k | while (!__ac_isempty(h->flags, i) && (568k __ac_isdel568k (h->flags, i) || !568k __hash_equal568k (h->keys[i], key))) { \ | 326 | 568k | if (__ac_isdel(h->flags, i)) site = i0 ; \ | 327 | 568k | i = (i + (++step)) & mask; \ | 328 | 568k | if (i == last) { x = site; break; }0 \ | 329 | 568k | } \ | 330 | 151k | if (x == h->n_buckets) { \ | 331 | 151k | if (__ac_isempty(h->flags, i) && site != h->n_buckets) x = site0 ; \ | 332 | 151k | else x = i; \ | 333 | 151k | } \ | 334 | 151k | } \ | 335 | 268k | } \ | 336 | 268k | if (__ac_isempty(h->flags, x)) { /* not present at all */ \ | 337 | 268k | h->keys[x] = key; \ | 338 | 268k | __ac_set_isboth_false(h->flags, x); \ | 339 | 268k | ++h->size; ++h->n_occupied; \ | 340 | 268k | *ret = 1; \ | 341 | 268k | } else if (0 __ac_isdel0 (h->flags, x)) { /* deleted */ \ | 342 | 0 | h->keys[x] = key; \ | 343 | 0 | __ac_set_isboth_false(h->flags, x); \ | 344 | 0 | ++h->size; \ | 345 | 0 | *ret = 2; \ | 346 | 0 | } else *ret = 0; /* Don't touch h->keys[x] if present and not deleted */ \ | 347 | 268k | return x; \ | 348 | 268k | } \ |
Unexecuted instantiation: ccv_nnc_cmd.c:kh_put_stream_map Unexecuted instantiation: ccv_nnc_tensor.c:kh_put_stream_map Unexecuted instantiation: ccv_nnc_tensor_io.c:kh_put_stream_map Unexecuted instantiation: ccv_nnc_stream.c:kh_put_stream_map ccv_nnc_micro.c:kh_put_ccv_nnc_ids Line | Count | Source | 308 | 9 | { \ | 309 | 9 | khint_t x; \ | 310 | 9 | if (h->n_occupied >= h->upper_bound) { /* update the hash table */ \ | 311 | 3 | if (h->n_buckets > (h->size<<1)) { \ | 312 | 0 | if (kh_resize_##name(h, h->n_buckets - 1) < 0) { /* clear "deleted" elements */ \ | 313 | 0 | *ret = -1; return h->n_buckets; \ | 314 | 0 | } \ | 315 | 3 | } else if (kh_resize_##name(h, h->n_buckets + 1) < 0) { /* expand the hash table */ \ | 316 | 0 | *ret = -1; return h->n_buckets; \ | 317 | 0 | } \ | 318 | 3 | } /* TODO: to implement automatically shrinking; resize() already support shrinking */ \ | 319 | 9 | { \ | 320 | 9 | khint_t k, i, site, last, mask = h->n_buckets - 1, step = 0; \ | 321 | 9 | x = site = h->n_buckets; k = __hash_func(key); i = k & mask; \ | 322 | 9 | if (__ac_isempty(h->flags, i)) x = i3 ; /* for speed up */ \ | 323 | 9 | else { \ | 324 | 6 | last = i; \ | 325 | 15 | while (!__ac_isempty(h->flags, i) && (9 __ac_isdel9 (h->flags, i) || !9 __hash_equal9 (h->keys[i], key))) { \ | 326 | 9 | if (__ac_isdel(h->flags, i)) site = i0 ; \ | 327 | 9 | i = (i + (++step)) & mask; \ | 328 | 9 | if (i == last) { x = site; break; }0 \ | 329 | 9 | } \ | 330 | 6 | if (x == h->n_buckets) { \ | 331 | 6 | if (__ac_isempty(h->flags, i) && site != h->n_buckets) x = site0 ; \ | 332 | 6 | else x = i; \ | 333 | 6 | } \ | 334 | 6 | } \ | 335 | 9 | } \ | 336 | 9 | if (__ac_isempty(h->flags, x)) { /* not present at all */ \ | 337 | 9 | h->keys[x] = key; \ | 338 | 9 | __ac_set_isboth_false(h->flags, x); \ | 339 | 9 | ++h->size; ++h->n_occupied; \ | 340 | 9 | *ret = 1; \ | 341 | 9 | } else if (0 __ac_isdel0 (h->flags, x)) { /* deleted */ \ | 342 | 0 | h->keys[x] = key; \ | 343 | 0 | __ac_set_isboth_false(h->flags, x); \ | 344 | 0 | ++h->size; \ | 345 | 0 | *ret = 2; \ | 346 | 0 | } else *ret = 0; /* Don't touch h->keys[x] if present and not deleted */ \ | 347 | 9 | return x; \ | 348 | 9 | } \ |
ccv_nnc_micro.c:kh_put_ccv_nnc_micro_bind_scalar Line | Count | Source | 308 | 3 | { \ | 309 | 3 | khint_t x; \ | 310 | 3 | if (h->n_occupied >= h->upper_bound) { /* update the hash table */ \ | 311 | 1 | if (h->n_buckets > (h->size<<1)) { \ | 312 | 0 | if (kh_resize_##name(h, h->n_buckets - 1) < 0) { /* clear "deleted" elements */ \ | 313 | 0 | *ret = -1; return h->n_buckets; \ | 314 | 0 | } \ | 315 | 1 | } else if (kh_resize_##name(h, h->n_buckets + 1) < 0) { /* expand the hash table */ \ | 316 | 0 | *ret = -1; return h->n_buckets; \ | 317 | 0 | } \ | 318 | 1 | } /* TODO: to implement automatically shrinking; resize() already support shrinking */ \ | 319 | 3 | { \ | 320 | 3 | khint_t k, i, site, last, mask = h->n_buckets - 1, step = 0; \ | 321 | 3 | x = site = h->n_buckets; k = __hash_func(key); i = k & mask; \ | 322 | 3 | if (__ac_isempty(h->flags, i)) x = i2 ; /* for speed up */ \ | 323 | 3 | else { \ | 324 | 1 | last = i; \ | 325 | 3 | while (!__ac_isempty(h->flags, i) && (2 __ac_isdel2 (h->flags, i) || !2 __hash_equal2 (h->keys[i], key))) { \ | 326 | 2 | if (__ac_isdel(h->flags, i)) site = i0 ; \ | 327 | 2 | i = (i + (++step)) & mask; \ | 328 | 2 | if (i == last) { x = site; break; }0 \ | 329 | 2 | } \ | 330 | 1 | if (x == h->n_buckets) { \ | 331 | 1 | if (__ac_isempty(h->flags, i) && site != h->n_buckets) x = site0 ; \ | 332 | 1 | else x = i; \ | 333 | 1 | } \ | 334 | 1 | } \ | 335 | 3 | } \ | 336 | 3 | if (__ac_isempty(h->flags, x)) { /* not present at all */ \ | 337 | 3 | h->keys[x] = key; \ | 338 | 3 | __ac_set_isboth_false(h->flags, x); \ | 339 | 3 | ++h->size; ++h->n_occupied; \ | 340 | 3 | *ret = 1; \ | 341 | 3 | } else if (0 __ac_isdel0 (h->flags, x)) { /* deleted */ \ | 342 | 0 | h->keys[x] = key; \ | 343 | 0 | __ac_set_isboth_false(h->flags, x); \ | 344 | 0 | ++h->size; \ | 345 | 0 | *ret = 2; \ | 346 | 0 | } else *ret = 0; /* Don't touch h->keys[x] if present and not deleted */ \ | 347 | 3 | return x; \ | 348 | 3 | } \ |
ccv_nnc_micro_simplify.c:kh_put_ccv_nnc_axis_id_group Line | Count | Source | 308 | 4 | { \ | 309 | 4 | khint_t x; \ | 310 | 4 | if (h->n_occupied >= h->upper_bound) { /* update the hash table */ \ | 311 | 4 | if (h->n_buckets > (h->size<<1)) { \ | 312 | 0 | if (kh_resize_##name(h, h->n_buckets - 1) < 0) { /* clear "deleted" elements */ \ | 313 | 0 | *ret = -1; return h->n_buckets; \ | 314 | 0 | } \ | 315 | 4 | } else if (kh_resize_##name(h, h->n_buckets + 1) < 0) { /* expand the hash table */ \ | 316 | 0 | *ret = -1; return h->n_buckets; \ | 317 | 0 | } \ | 318 | 4 | } /* TODO: to implement automatically shrinking; resize() already support shrinking */ \ | 319 | 4 | { \ | 320 | 4 | khint_t k, i, site, last, mask = h->n_buckets - 1, step = 0; \ | 321 | 4 | x = site = h->n_buckets; k = __hash_func(key); i = k & mask; \ | 322 | 4 | if (__ac_isempty(h->flags, i)) x = i; /* for speed up */ \ | 323 | 4 | else { \ | 324 | 0 | last = i; \ | 325 | 0 | while (!__ac_isempty(h->flags, i) && (__ac_isdel(h->flags, i) || !__hash_equal(h->keys[i], key))) { \ | 326 | 0 | if (__ac_isdel(h->flags, i)) site = i; \ | 327 | 0 | i = (i + (++step)) & mask; \ | 328 | 0 | if (i == last) { x = site; break; } \ | 329 | 0 | } \ | 330 | 0 | if (x == h->n_buckets) { \ | 331 | 0 | if (__ac_isempty(h->flags, i) && site != h->n_buckets) x = site; \ | 332 | 0 | else x = i; \ | 333 | 0 | } \ | 334 | 0 | } \ | 335 | 4 | } \ | 336 | 4 | if (__ac_isempty(h->flags, x)) { /* not present at all */ \ | 337 | 4 | h->keys[x] = key; \ | 338 | 4 | __ac_set_isboth_false(h->flags, x); \ | 339 | 4 | ++h->size; ++h->n_occupied; \ | 340 | 4 | *ret = 1; \ | 341 | 4 | } else if (0 __ac_isdel0 (h->flags, x)) { /* deleted */ \ | 342 | 0 | h->keys[x] = key; \ | 343 | 0 | __ac_set_isboth_false(h->flags, x); \ | 344 | 0 | ++h->size; \ | 345 | 0 | *ret = 2; \ | 346 | 0 | } else *ret = 0; /* Don't touch h->keys[x] if present and not deleted */ \ | 347 | 4 | return x; \ | 348 | 4 | } \ |
Unexecuted instantiation: ccv_nnc_graph.c:kh_put_stream_map Unexecuted instantiation: ccv_nnc_symbolic_graph_io.c:kh_put_stream_map Unexecuted instantiation: ccv_nnc_symbolic_graph_compile.c:kh_put_stream_map Unexecuted instantiation: ccv_nnc_symbolic_graph_compile.c:kh_put_obj_ptr Unexecuted instantiation: ccv_nnc_graph_while.c:kh_put_stream_map Unexecuted instantiation: ccv_nnc_tensor_tape.c:kh_put_stream_map Unexecuted instantiation: ccv_nnc_graph_case_of.c:kh_put_stream_map Unexecuted instantiation: ccv_nnc_graph_run.c:kh_put_stream_map ccv_nnc_xpu_alloc.c:kh_put_dy_str Line | Count | Source | 308 | 723 | { \ | 309 | 723 | khint_t x; \ | 310 | 723 | if (h->n_occupied >= h->upper_bound) { /* update the hash table */ \ | 311 | 12 | if (h->n_buckets > (h->size<<1)) { \ | 312 | 0 | if (kh_resize_##name(h, h->n_buckets - 1) < 0) { /* clear "deleted" elements */ \ | 313 | 0 | *ret = -1; return h->n_buckets; \ | 314 | 0 | } \ | 315 | 12 | } else if (kh_resize_##name(h, h->n_buckets + 1) < 0) { /* expand the hash table */ \ | 316 | 0 | *ret = -1; return h->n_buckets; \ | 317 | 0 | } \ | 318 | 12 | } /* TODO: to implement automatically shrinking; resize() already support shrinking */ \ | 319 | 723 | { \ | 320 | 723 | khint_t k, i, site, last, mask = h->n_buckets - 1, step = 0; \ | 321 | 723 | x = site = h->n_buckets; k = __hash_func(key); i = k & mask; \ | 322 | 723 | if (__ac_isempty(h->flags, i)) x = i12 ; /* for speed up */ \ | 323 | 723 | else { \ | 324 | 711 | last = i; \ | 325 | 1.11k | while (!__ac_isempty(h->flags, i) && (1.10k __ac_isdel1.10k (h->flags, i) || !1.10k __hash_equal1.10k (h->keys[i], key))) { \ | 326 | 400 | if (__ac_isdel(h->flags, i)) site = i0 ; \ | 327 | 400 | i = (i + (++step)) & mask; \ | 328 | 400 | if (i == last) { x = site; break; }0 \ | 329 | 400 | } \ | 330 | 711 | if (x == h->n_buckets) { \ | 331 | 711 | if (__ac_isempty(h->flags, i) && site != h->n_buckets7 ) x = site0 ; \ | 332 | 711 | else x = i; \ | 333 | 711 | } \ | 334 | 711 | } \ | 335 | 723 | } \ | 336 | 723 | if (__ac_isempty(h->flags, x)) { /* not present at all */ \ | 337 | 19 | h->keys[x] = key; \ | 338 | 19 | __ac_set_isboth_false(h->flags, x); \ | 339 | 19 | ++h->size; ++h->n_occupied; \ | 340 | 19 | *ret = 1; \ | 341 | 704 | } else if (__ac_isdel(h->flags, x)) { /* deleted */ \ | 342 | 0 | h->keys[x] = key; \ | 343 | 0 | __ac_set_isboth_false(h->flags, x); \ | 344 | 0 | ++h->size; \ | 345 | 0 | *ret = 2; \ | 346 | 704 | } else *ret = 0; /* Don't touch h->keys[x] if present and not deleted */ \ | 347 | 723 | return x; \ | 348 | 723 | } \ |
ccv_nnc_xpu_alloc.c:kh_put_dy_alloc Line | Count | Source | 308 | 723 | { \ | 309 | 723 | khint_t x; \ | 310 | 723 | if (h->n_occupied >= h->upper_bound) { /* update the hash table */ \ | 311 | 137 | if (h->n_buckets > (h->size<<1)) { \ | 312 | 102 | if (kh_resize_##name(h, h->n_buckets - 1) < 0) { /* clear "deleted" elements */ \ | 313 | 0 | *ret = -1; return h->n_buckets; \ | 314 | 0 | } \ | 315 | 102 | } else if (kh_resize_35 ##name(h, h->n_buckets + 1) < 035 ) { /* expand the hash table */ \ | 316 | 0 | *ret = -1; return h->n_buckets; \ | 317 | 0 | } \ | 318 | 137 | } /* TODO: to implement automatically shrinking; resize() already support shrinking */ \ | 319 | 723 | { \ | 320 | 723 | khint_t k, i, site, last, mask = h->n_buckets - 1, step = 0; \ | 321 | 723 | x = site = h->n_buckets; k = __hash_func(key); i = k & mask; \ | 322 | 723 | if (__ac_isempty(h->flags, i)) x = i112 ; /* for speed up */ \ | 323 | 723 | else { \ | 324 | 611 | last = i; \ | 325 | 7.47k | while (!__ac_isempty(h->flags, i) && (6.86k __ac_isdel6.86k (h->flags, i) || !5.65k __hash_equal5.65k (h->keys[i], key))) { \ | 326 | 6.86k | if (__ac_isdel(h->flags, i)) site = i1.20k ; \ | 327 | 6.86k | i = (i + (++step)) & mask; \ | 328 | 6.86k | if (i == last) { x = site; break; }0 \ | 329 | 6.86k | } \ | 330 | 611 | if (x == h->n_buckets) { \ | 331 | 611 | if (__ac_isempty(h->flags, i) && site != h->n_buckets) x = site160 ; \ | 332 | 611 | else x = i451 ; \ | 333 | 611 | } \ | 334 | 611 | } \ | 335 | 723 | } \ | 336 | 723 | if (__ac_isempty(h->flags, x)) { /* not present at all */ \ | 337 | 563 | h->keys[x] = key; \ | 338 | 563 | __ac_set_isboth_false(h->flags, x); \ | 339 | 563 | ++h->size; ++h->n_occupied; \ | 340 | 563 | *ret = 1; \ | 341 | 563 | } else if (160 __ac_isdel160 (h->flags, x)) { /* deleted */ \ | 342 | 160 | h->keys[x] = key; \ | 343 | 160 | __ac_set_isboth_false(h->flags, x); \ | 344 | 160 | ++h->size; \ | 345 | 160 | *ret = 2; \ | 346 | 160 | } else *ret = 00 ; /* Don't touch h->keys[x] if present and not deleted */ \ | 347 | 723 | return x; \ | 348 | 723 | } \ |
ccv_nnc_xpu_alloc.c:kh_put_dy_dev Line | Count | Source | 308 | 675 | { \ | 309 | 675 | khint_t x; \ | 310 | 675 | if (h->n_occupied >= h->upper_bound) { /* update the hash table */ \ | 311 | 23 | if (h->n_buckets > (h->size<<1)) { \ | 312 | 0 | if (kh_resize_##name(h, h->n_buckets - 1) < 0) { /* clear "deleted" elements */ \ | 313 | 0 | *ret = -1; return h->n_buckets; \ | 314 | 0 | } \ | 315 | 23 | } else if (kh_resize_##name(h, h->n_buckets + 1) < 0) { /* expand the hash table */ \ | 316 | 0 | *ret = -1; return h->n_buckets; \ | 317 | 0 | } \ | 318 | 23 | } /* TODO: to implement automatically shrinking; resize() already support shrinking */ \ | 319 | 675 | { \ | 320 | 675 | khint_t k, i, site, last, mask = h->n_buckets - 1, step = 0; \ | 321 | 675 | x = site = h->n_buckets; k = __hash_func(key); i = k & mask; \ | 322 | 675 | if (__ac_isempty(h->flags, i)) x = i42 ; /* for speed up */ \ | 323 | 675 | else { \ | 324 | 633 | last = i; \ | 325 | 633 | while (!__ac_isempty(h->flags, i) && (__ac_isdel(h->flags, i) || !__hash_equal(h->keys[i], key))) { \ | 326 | 0 | if (__ac_isdel(h->flags, i)) site = i; \ | 327 | 0 | i = (i + (++step)) & mask; \ | 328 | 0 | if (i == last) { x = site; break; } \ | 329 | 0 | } \ | 330 | 633 | if (x == h->n_buckets) { \ | 331 | 633 | if (__ac_isempty(h->flags, i) && site != h->n_buckets0 ) x = site0 ; \ | 332 | 633 | else x = i; \ | 333 | 633 | } \ | 334 | 633 | } \ | 335 | 675 | } \ | 336 | 675 | if (__ac_isempty(h->flags, x)) { /* not present at all */ \ | 337 | 42 | h->keys[x] = key; \ | 338 | 42 | __ac_set_isboth_false(h->flags, x); \ | 339 | 42 | ++h->size; ++h->n_occupied; \ | 340 | 42 | *ret = 1; \ | 341 | 633 | } else if (__ac_isdel(h->flags, x)) { /* deleted */ \ | 342 | 0 | h->keys[x] = key; \ | 343 | 0 | __ac_set_isboth_false(h->flags, x); \ | 344 | 0 | ++h->size; \ | 345 | 0 | *ret = 2; \ | 346 | 633 | } else *ret = 0; /* Don't touch h->keys[x] if present and not deleted */ \ | 347 | 675 | return x; \ | 348 | 675 | } \ |
Unexecuted instantiation: ccv_nnc_xpu_alloc.c:kh_put_stream_map ccv_nnc_dynamic_graph.c:kh_put_stream_map Line | Count | Source | 308 | 72 | { \ | 309 | 72 | khint_t x; \ | 310 | 72 | if (h->n_occupied >= h->upper_bound) { /* update the hash table */ \ | 311 | 12 | if (h->n_buckets > (h->size<<1)) { \ | 312 | 0 | if (kh_resize_##name(h, h->n_buckets - 1) < 0) { /* clear "deleted" elements */ \ | 313 | 0 | *ret = -1; return h->n_buckets; \ | 314 | 0 | } \ | 315 | 12 | } else if (kh_resize_##name(h, h->n_buckets + 1) < 0) { /* expand the hash table */ \ | 316 | 0 | *ret = -1; return h->n_buckets; \ | 317 | 0 | } \ | 318 | 12 | } /* TODO: to implement automatically shrinking; resize() already support shrinking */ \ | 319 | 72 | { \ | 320 | 72 | khint_t k, i, site, last, mask = h->n_buckets - 1, step = 0; \ | 321 | 72 | x = site = h->n_buckets; k = __hash_func(key); i = k & mask; \ | 322 | 72 | if (__ac_isempty(h->flags, i)) x = i10 ; /* for speed up */ \ | 323 | 72 | else { \ | 324 | 62 | last = i; \ | 325 | 153 | while (!__ac_isempty(h->flags, i) && (140 __ac_isdel140 (h->flags, i) || !140 __hash_equal140 (h->keys[i], key))) { \ | 326 | 91 | if (__ac_isdel(h->flags, i)) site = i0 ; \ | 327 | 91 | i = (i + (++step)) & mask; \ | 328 | 91 | if (i == last) { x = site; break; }0 \ | 329 | 91 | } \ | 330 | 62 | if (x == h->n_buckets) { \ | 331 | 62 | if (__ac_isempty(h->flags, i) && site != h->n_buckets13 ) x = site0 ; \ | 332 | 62 | else x = i; \ | 333 | 62 | } \ | 334 | 62 | } \ | 335 | 72 | } \ | 336 | 72 | if (__ac_isempty(h->flags, x)) { /* not present at all */ \ | 337 | 23 | h->keys[x] = key; \ | 338 | 23 | __ac_set_isboth_false(h->flags, x); \ | 339 | 23 | ++h->size; ++h->n_occupied; \ | 340 | 23 | *ret = 1; \ | 341 | 49 | } else if (__ac_isdel(h->flags, x)) { /* deleted */ \ | 342 | 0 | h->keys[x] = key; \ | 343 | 0 | __ac_set_isboth_false(h->flags, x); \ | 344 | 0 | ++h->size; \ | 345 | 0 | *ret = 2; \ | 346 | 49 | } else *ret = 0; /* Don't touch h->keys[x] if present and not deleted */ \ | 347 | 72 | return x; \ | 348 | 72 | } \ |
Unexecuted instantiation: ccv_nnc_dynamic_graph.c:kh_put_dy_dev Unexecuted instantiation: ccv_nnc_dynamic_graph.c:kh_put_dy_str Unexecuted instantiation: ccv_nnc_dynamic_graph.c:kh_put_dy_alloc Unexecuted instantiation: ccv_nnc_dynamic_graph.c:kh_put_stateful_exec Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:kh_put_stream_map Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:kh_put_dy_dev Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:kh_put_dy_str Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:kh_put_dy_alloc Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:kh_put_stateful_exec Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:kh_put_stream_map Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:kh_put_dy_dev Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:kh_put_dy_str Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:kh_put_dy_alloc Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:kh_put_stateful_exec Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:kh_put_stream_map Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:kh_put_dy_dev Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:kh_put_dy_str Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:kh_put_dy_alloc Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:kh_put_stateful_exec Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:kh_put_stream_map Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:kh_put_dy_dev Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:kh_put_dy_str Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:kh_put_dy_alloc Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:kh_put_stateful_exec Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:kh_put_stream_map Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:kh_put_dy_dev Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:kh_put_dy_str Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:kh_put_dy_alloc Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:kh_put_stateful_exec Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:kh_put_ccv_cnnp_model_name_bank ccv_cnnp_dataframe.c:kh_put_ctx Line | Count | Source | 308 | 182k | { \ | 309 | 182k | khint_t x; \ | 310 | 182k | if (h->n_occupied >= h->upper_bound) { /* update the hash table */ \ | 311 | 56 | if (h->n_buckets > (h->size<<1)) { \ | 312 | 0 | if (kh_resize_##name(h, h->n_buckets - 1) < 0) { /* clear "deleted" elements */ \ | 313 | 0 | *ret = -1; return h->n_buckets; \ | 314 | 0 | } \ | 315 | 56 | } else if (kh_resize_##name(h, h->n_buckets + 1) < 0) { /* expand the hash table */ \ | 316 | 0 | *ret = -1; return h->n_buckets; \ | 317 | 0 | } \ | 318 | 56 | } /* TODO: to implement automatically shrinking; resize() already support shrinking */ \ | 319 | 182k | { \ | 320 | 182k | khint_t k, i, site, last, mask = h->n_buckets - 1, step = 0; \ | 321 | 182k | x = site = h->n_buckets; k = __hash_func(key); i = k & mask; \ | 322 | 182k | if (__ac_isempty(h->flags, i)) x = i56 ; /* for speed up */ \ | 323 | 182k | else { \ | 324 | 182k | last = i; \ | 325 | 256k | while (!__ac_isempty(h->flags, i) && (256k __ac_isdel256k (h->flags, i) || !256k __hash_equal256k (h->keys[i], key))) { \ | 326 | 74.5k | if (__ac_isdel(h->flags, i)) site = i0 ; \ | 327 | 74.5k | i = (i + (++step)) & mask; \ | 328 | 74.5k | if (i == last) { x = site; break; }0 \ | 329 | 74.5k | } \ | 330 | 182k | if (x == h->n_buckets) { \ | 331 | 182k | if (__ac_isempty(h->flags, i) && site != h->n_buckets6 ) x = site0 ; \ | 332 | 182k | else x = i; \ | 333 | 182k | } \ | 334 | 182k | } \ | 335 | 182k | } \ | 336 | 182k | if (__ac_isempty(h->flags, x)) { /* not present at all */ \ | 337 | 62 | h->keys[x] = key; \ | 338 | 62 | __ac_set_isboth_false(h->flags, x); \ | 339 | 62 | ++h->size; ++h->n_occupied; \ | 340 | 62 | *ret = 1; \ | 341 | 182k | } else if (__ac_isdel(h->flags, x)) { /* deleted */ \ | 342 | 0 | h->keys[x] = key; \ | 343 | 0 | __ac_set_isboth_false(h->flags, x); \ | 344 | 0 | ++h->size; \ | 345 | 0 | *ret = 2; \ | 346 | 182k | } else *ret = 0; /* Don't touch h->keys[x] if present and not deleted */ \ | 347 | 182k | return x; \ | 348 | 182k | } \ |
ccv_cnnp_dataframe.c:kh_put_iter_ctx Line | Count | Source | 308 | 603 | { \ | 309 | 603 | khint_t x; \ | 310 | 603 | if (h->n_occupied >= h->upper_bound) { /* update the hash table */ \ | 311 | 4 | if (h->n_buckets > (h->size<<1)) { \ | 312 | 0 | if (kh_resize_##name(h, h->n_buckets - 1) < 0) { /* clear "deleted" elements */ \ | 313 | 0 | *ret = -1; return h->n_buckets; \ | 314 | 0 | } \ | 315 | 4 | } else if (kh_resize_##name(h, h->n_buckets + 1) < 0) { /* expand the hash table */ \ | 316 | 0 | *ret = -1; return h->n_buckets; \ | 317 | 0 | } \ | 318 | 4 | } /* TODO: to implement automatically shrinking; resize() already support shrinking */ \ | 319 | 603 | { \ | 320 | 603 | khint_t k, i, site, last, mask = h->n_buckets - 1, step = 0; \ | 321 | 603 | x = site = h->n_buckets; k = __hash_func(key); i = k & mask; \ | 322 | 603 | if (__ac_isempty(h->flags, i)) x = i4 ; /* for speed up */ \ | 323 | 603 | else { \ | 324 | 599 | last = i; \ | 325 | 887 | while (!__ac_isempty(h->flags, i) && (885 __ac_isdel885 (h->flags, i) || !885 __hash_equal885 (h->keys[i], key))) { \ | 326 | 288 | if (__ac_isdel(h->flags, i)) site = i0 ; \ | 327 | 288 | i = (i + (++step)) & mask; \ | 328 | 288 | if (i == last) { x = site; break; }0 \ | 329 | 288 | } \ | 330 | 599 | if (x == h->n_buckets) { \ | 331 | 599 | if (__ac_isempty(h->flags, i) && site != h->n_buckets2 ) x = site0 ; \ | 332 | 599 | else x = i; \ | 333 | 599 | } \ | 334 | 599 | } \ | 335 | 603 | } \ | 336 | 603 | if (__ac_isempty(h->flags, x)) { /* not present at all */ \ | 337 | 6 | h->keys[x] = key; \ | 338 | 6 | __ac_set_isboth_false(h->flags, x); \ | 339 | 6 | ++h->size; ++h->n_occupied; \ | 340 | 6 | *ret = 1; \ | 341 | 597 | } else if (__ac_isdel(h->flags, x)) { /* deleted */ \ | 342 | 0 | h->keys[x] = key; \ | 343 | 0 | __ac_set_isboth_false(h->flags, x); \ | 344 | 0 | ++h->size; \ | 345 | 0 | *ret = 2; \ | 346 | 597 | } else *ret = 0; /* Don't touch h->keys[x] if present and not deleted */ \ | 347 | 603 | return x; \ | 348 | 603 | } \ |
ccv_cnnp_model.c:kh_put_ccv_cnnp_model_name_bank Line | Count | Source | 308 | 1.23k | { \ | 309 | 1.23k | khint_t x; \ | 310 | 1.23k | if (h->n_occupied >= h->upper_bound) { /* update the hash table */ \ | 311 | 1.23k | if (h->n_buckets > (h->size<<1)) { \ | 312 | 0 | if (kh_resize_##name(h, h->n_buckets - 1) < 0) { /* clear "deleted" elements */ \ | 313 | 0 | *ret = -1; return h->n_buckets; \ | 314 | 0 | } \ | 315 | 1.23k | } else if (kh_resize_##name(h, h->n_buckets + 1) < 0) { /* expand the hash table */ \ | 316 | 0 | *ret = -1; return h->n_buckets; \ | 317 | 0 | } \ | 318 | 1.23k | } /* TODO: to implement automatically shrinking; resize() already support shrinking */ \ | 319 | 1.23k | { \ | 320 | 1.23k | khint_t k, i, site, last, mask = h->n_buckets - 1, step = 0; \ | 321 | 1.23k | x = site = h->n_buckets; k = __hash_func(key); i = k & mask; \ | 322 | 1.23k | if (__ac_isempty(h->flags, i)) x = i; /* for speed up */ \ | 323 | 1.23k | else { \ | 324 | 0 | last = i; \ | 325 | 0 | while (!__ac_isempty(h->flags, i) && (__ac_isdel(h->flags, i) || !__hash_equal(h->keys[i], key))) { \ | 326 | 0 | if (__ac_isdel(h->flags, i)) site = i; \ | 327 | 0 | i = (i + (++step)) & mask; \ | 328 | 0 | if (i == last) { x = site; break; } \ | 329 | 0 | } \ | 330 | 0 | if (x == h->n_buckets) { \ | 331 | 0 | if (__ac_isempty(h->flags, i) && site != h->n_buckets) x = site; \ | 332 | 0 | else x = i; \ | 333 | 0 | } \ | 334 | 0 | } \ | 335 | 1.23k | } \ | 336 | 1.23k | if (__ac_isempty(h->flags, x)) { /* not present at all */ \ | 337 | 1.23k | h->keys[x] = key; \ | 338 | 1.23k | __ac_set_isboth_false(h->flags, x); \ | 339 | 1.23k | ++h->size; ++h->n_occupied; \ | 340 | 1.23k | *ret = 1; \ | 341 | 1.23k | } else if (0 __ac_isdel0 (h->flags, x)) { /* deleted */ \ | 342 | 0 | h->keys[x] = key; \ | 343 | 0 | __ac_set_isboth_false(h->flags, x); \ | 344 | 0 | ++h->size; \ | 345 | 0 | *ret = 2; \ | 346 | 0 | } else *ret = 0; /* Don't touch h->keys[x] if present and not deleted */ \ | 347 | 1.23k | return x; \ | 348 | 1.23k | } \ |
ccv_cnnp_model.c:kh_put_ccv_cnnp_parameter_id Line | Count | Source | 308 | 1 | { \ | 309 | 1 | khint_t x; \ | 310 | 1 | if (h->n_occupied >= h->upper_bound) { /* update the hash table */ \ | 311 | 1 | if (h->n_buckets > (h->size<<1)) { \ | 312 | 0 | if (kh_resize_##name(h, h->n_buckets - 1) < 0) { /* clear "deleted" elements */ \ | 313 | 0 | *ret = -1; return h->n_buckets; \ | 314 | 0 | } \ | 315 | 1 | } else if (kh_resize_##name(h, h->n_buckets + 1) < 0) { /* expand the hash table */ \ | 316 | 0 | *ret = -1; return h->n_buckets; \ | 317 | 0 | } \ | 318 | 1 | } /* TODO: to implement automatically shrinking; resize() already support shrinking */ \ | 319 | 1 | { \ | 320 | 1 | khint_t k, i, site, last, mask = h->n_buckets - 1, step = 0; \ | 321 | 1 | x = site = h->n_buckets; k = __hash_func(key); i = k & mask; \ | 322 | 1 | if (__ac_isempty(h->flags, i)) x = i; /* for speed up */ \ | 323 | 1 | else { \ | 324 | 0 | last = i; \ | 325 | 0 | while (!__ac_isempty(h->flags, i) && (__ac_isdel(h->flags, i) || !__hash_equal(h->keys[i], key))) { \ | 326 | 0 | if (__ac_isdel(h->flags, i)) site = i; \ | 327 | 0 | i = (i + (++step)) & mask; \ | 328 | 0 | if (i == last) { x = site; break; } \ | 329 | 0 | } \ | 330 | 0 | if (x == h->n_buckets) { \ | 331 | 0 | if (__ac_isempty(h->flags, i) && site != h->n_buckets) x = site; \ | 332 | 0 | else x = i; \ | 333 | 0 | } \ | 334 | 0 | } \ | 335 | 1 | } \ | 336 | 1 | if (__ac_isempty(h->flags, x)) { /* not present at all */ \ | 337 | 1 | h->keys[x] = key; \ | 338 | 1 | __ac_set_isboth_false(h->flags, x); \ | 339 | 1 | ++h->size; ++h->n_occupied; \ | 340 | 1 | *ret = 1; \ | 341 | 1 | } else if (0 __ac_isdel0 (h->flags, x)) { /* deleted */ \ | 342 | 0 | h->keys[x] = key; \ | 343 | 0 | __ac_set_isboth_false(h->flags, x); \ | 344 | 0 | ++h->size; \ | 345 | 0 | *ret = 2; \ | 346 | 0 | } else *ret = 0; /* Don't touch h->keys[x] if present and not deleted */ \ | 347 | 1 | return x; \ | 348 | 1 | } \ |
ccv_cnnp_model.c:kh_put_stream_map Line | Count | Source | 308 | 24 | { \ | 309 | 24 | khint_t x; \ | 310 | 24 | if (h->n_occupied >= h->upper_bound) { /* update the hash table */ \ | 311 | 8 | if (h->n_buckets > (h->size<<1)) { \ | 312 | 0 | if (kh_resize_##name(h, h->n_buckets - 1) < 0) { /* clear "deleted" elements */ \ | 313 | 0 | *ret = -1; return h->n_buckets; \ | 314 | 0 | } \ | 315 | 8 | } else if (kh_resize_##name(h, h->n_buckets + 1) < 0) { /* expand the hash table */ \ | 316 | 0 | *ret = -1; return h->n_buckets; \ | 317 | 0 | } \ | 318 | 8 | } /* TODO: to implement automatically shrinking; resize() already support shrinking */ \ | 319 | 24 | { \ | 320 | 24 | khint_t k, i, site, last, mask = h->n_buckets - 1, step = 0; \ | 321 | 24 | x = site = h->n_buckets; k = __hash_func(key); i = k & mask; \ | 322 | 24 | if (__ac_isempty(h->flags, i)) x = i4 ; /* for speed up */ \ | 323 | 24 | else { \ | 324 | 20 | last = i; \ | 325 | 56 | while (!__ac_isempty(h->flags, i) && (44 __ac_isdel44 (h->flags, i) || !44 __hash_equal44 (h->keys[i], key))) { \ | 326 | 36 | if (__ac_isdel(h->flags, i)) site = i0 ; \ | 327 | 36 | i = (i + (++step)) & mask; \ | 328 | 36 | if (i == last) { x = site; break; }0 \ | 329 | 36 | } \ | 330 | 20 | if (x == h->n_buckets) { \ | 331 | 20 | if (__ac_isempty(h->flags, i) && site != h->n_buckets12 ) x = site0 ; \ | 332 | 20 | else x = i; \ | 333 | 20 | } \ | 334 | 20 | } \ | 335 | 24 | } \ | 336 | 24 | if (__ac_isempty(h->flags, x)) { /* not present at all */ \ | 337 | 16 | h->keys[x] = key; \ | 338 | 16 | __ac_set_isboth_false(h->flags, x); \ | 339 | 16 | ++h->size; ++h->n_occupied; \ | 340 | 16 | *ret = 1; \ | 341 | 16 | } else if (8 __ac_isdel8 (h->flags, x)) { /* deleted */ \ | 342 | 0 | h->keys[x] = key; \ | 343 | 0 | __ac_set_isboth_false(h->flags, x); \ | 344 | 0 | ++h->size; \ | 345 | 0 | *ret = 2; \ | 346 | 8 | } else *ret = 0; /* Don't touch h->keys[x] if present and not deleted */ \ | 347 | 24 | return x; \ | 348 | 24 | } \ |
Unexecuted instantiation: ccv_cnnp_model.c:kh_put_dy_dev Unexecuted instantiation: ccv_cnnp_model.c:kh_put_dy_str Unexecuted instantiation: ccv_cnnp_model.c:kh_put_dy_alloc Unexecuted instantiation: ccv_cnnp_model_io.c:kh_put_stream_map Unexecuted instantiation: ccv_cnnp_model_io.c:kh_put_dy_dev Unexecuted instantiation: ccv_cnnp_model_io.c:kh_put_dy_str Unexecuted instantiation: ccv_cnnp_model_io.c:kh_put_dy_alloc Unexecuted instantiation: ccv_cnnp_model_io.c:kh_put_ccv_cnnp_model_name_bank ccv_cnnp_model_core.c:kh_put_ccv_cnnp_model_name_bank Line | Count | Source | 308 | 1.48k | { \ | 309 | 1.48k | khint_t x; \ | 310 | 1.48k | if (h->n_occupied >= h->upper_bound) { /* update the hash table */ \ | 311 | 1.11k | if (h->n_buckets > (h->size<<1)) { \ | 312 | 0 | if (kh_resize_##name(h, h->n_buckets - 1) < 0) { /* clear "deleted" elements */ \ | 313 | 0 | *ret = -1; return h->n_buckets; \ | 314 | 0 | } \ | 315 | 1.11k | } else if (kh_resize_##name(h, h->n_buckets + 1) < 0) { /* expand the hash table */ \ | 316 | 0 | *ret = -1; return h->n_buckets; \ | 317 | 0 | } \ | 318 | 1.11k | } /* TODO: to implement automatically shrinking; resize() already support shrinking */ \ | 319 | 1.48k | { \ | 320 | 1.48k | khint_t k, i, site, last, mask = h->n_buckets - 1, step = 0; \ | 321 | 1.48k | x = site = h->n_buckets; k = __hash_func(key); i = k & mask; \ | 322 | 1.48k | if (__ac_isempty(h->flags, i)) x = i1.18k ; /* for speed up */ \ | 323 | 1.48k | else { \ | 324 | 299 | last = i; \ | 325 | 367 | while (!__ac_isempty(h->flags, i) && (324 __ac_isdel324 (h->flags, i) || !324 __hash_equal324 (h->keys[i], key))) { \ | 326 | 68 | if (__ac_isdel(h->flags, i)) site = i0 ; \ | 327 | 68 | i = (i + (++step)) & mask; \ | 328 | 68 | if (i == last) { x = site; break; }0 \ | 329 | 68 | } \ | 330 | 299 | if (x == h->n_buckets) { \ | 331 | 299 | if (__ac_isempty(h->flags, i) && site != h->n_buckets43 ) x = site0 ; \ | 332 | 299 | else x = i; \ | 333 | 299 | } \ | 334 | 299 | } \ | 335 | 1.48k | } \ | 336 | 1.48k | if (__ac_isempty(h->flags, x)) { /* not present at all */ \ | 337 | 1.22k | h->keys[x] = key; \ | 338 | 1.22k | __ac_set_isboth_false(h->flags, x); \ | 339 | 1.22k | ++h->size; ++h->n_occupied; \ | 340 | 1.22k | *ret = 1; \ | 341 | 1.22k | } else if (256 __ac_isdel256 (h->flags, x)) { /* deleted */ \ | 342 | 0 | h->keys[x] = key; \ | 343 | 0 | __ac_set_isboth_false(h->flags, x); \ | 344 | 0 | ++h->size; \ | 345 | 0 | *ret = 2; \ | 346 | 256 | } else *ret = 0; /* Don't touch h->keys[x] if present and not deleted */ \ | 347 | 1.48k | return x; \ | 348 | 1.48k | } \ |
ccv_cnnp_model_core.c:kh_put_model Line | Count | Source | 308 | 2.09k | { \ | 309 | 2.09k | khint_t x; \ | 310 | 2.09k | if (h->n_occupied >= h->upper_bound) { /* update the hash table */ \ | 311 | 1.02k | if (h->n_buckets > (h->size<<1)) { \ | 312 | 0 | if (kh_resize_##name(h, h->n_buckets - 1) < 0) { /* clear "deleted" elements */ \ | 313 | 0 | *ret = -1; return h->n_buckets; \ | 314 | 0 | } \ | 315 | 1.02k | } else if (kh_resize_##name(h, h->n_buckets + 1) < 0) { /* expand the hash table */ \ | 316 | 0 | *ret = -1; return h->n_buckets; \ | 317 | 0 | } \ | 318 | 1.02k | } /* TODO: to implement automatically shrinking; resize() already support shrinking */ \ | 319 | 2.09k | { \ | 320 | 2.09k | khint_t k, i, site, last, mask = h->n_buckets - 1, step = 0; \ | 321 | 2.09k | x = site = h->n_buckets; k = __hash_func(key); i = k & mask; \ | 322 | 2.09k | if (__ac_isempty(h->flags, i)) x = i1.00k ; /* for speed up */ \ | 323 | 2.09k | else { \ | 324 | 1.09k | last = i; \ | 325 | 2.68k | while (!__ac_isempty(h->flags, i) && (1.59k __ac_isdel1.59k (h->flags, i) || !1.59k __hash_equal1.59k (h->keys[i], key))) { \ | 326 | 1.59k | if (__ac_isdel(h->flags, i)) site = i0 ; \ | 327 | 1.59k | i = (i + (++step)) & mask; \ | 328 | 1.59k | if (i == last) { x = site; break; }0 \ | 329 | 1.59k | } \ | 330 | 1.09k | if (x == h->n_buckets) { \ | 331 | 1.09k | if (__ac_isempty(h->flags, i) && site != h->n_buckets1.09k ) x = site0 ; \ | 332 | 1.09k | else x = i; \ | 333 | 1.09k | } \ | 334 | 1.09k | } \ | 335 | 2.09k | } \ | 336 | 2.09k | if (__ac_isempty(h->flags, x)) { /* not present at all */ \ | 337 | 2.09k | h->keys[x] = key; \ | 338 | 2.09k | __ac_set_isboth_false(h->flags, x); \ | 339 | 2.09k | ++h->size; ++h->n_occupied; \ | 340 | 2.09k | *ret = 1; \ | 341 | 2.09k | } else if (1 __ac_isdel1 (h->flags, x)) { /* deleted */ \ | 342 | 0 | h->keys[x] = key; \ | 343 | 0 | __ac_set_isboth_false(h->flags, x); \ | 344 | 0 | ++h->size; \ | 345 | 0 | *ret = 2; \ | 346 | 1 | } else *ret = 0; /* Don't touch h->keys[x] if present and not deleted */ \ | 347 | 2.09k | return x; \ | 348 | 2.09k | } \ |
ccv_cnnp_model_core.c:kh_put_io_node Line | Count | Source | 308 | 5 | { \ | 309 | 5 | khint_t x; \ | 310 | 5 | if (h->n_occupied >= h->upper_bound) { /* update the hash table */ \ | 311 | 2 | if (h->n_buckets > (h->size<<1)) { \ | 312 | 0 | if (kh_resize_##name(h, h->n_buckets - 1) < 0) { /* clear "deleted" elements */ \ | 313 | 0 | *ret = -1; return h->n_buckets; \ | 314 | 0 | } \ | 315 | 2 | } else if (kh_resize_##name(h, h->n_buckets + 1) < 0) { /* expand the hash table */ \ | 316 | 0 | *ret = -1; return h->n_buckets; \ | 317 | 0 | } \ | 318 | 2 | } /* TODO: to implement automatically shrinking; resize() already support shrinking */ \ | 319 | 5 | { \ | 320 | 5 | khint_t k, i, site, last, mask = h->n_buckets - 1, step = 0; \ | 321 | 5 | x = site = h->n_buckets; k = __hash_func(key); i = k & mask; \ | 322 | 5 | if (__ac_isempty(h->flags, i)) x = i2 ; /* for speed up */ \ | 323 | 5 | else { \ | 324 | 3 | last = i; \ | 325 | 7 | while (!__ac_isempty(h->flags, i) && (4 __ac_isdel4 (h->flags, i) || !4 __hash_equal4 (h->keys[i], key))) { \ | 326 | 4 | if (__ac_isdel(h->flags, i)) site = i0 ; \ | 327 | 4 | i = (i + (++step)) & mask; \ | 328 | 4 | if (i == last) { x = site; break; }0 \ | 329 | 4 | } \ | 330 | 3 | if (x == h->n_buckets) { \ | 331 | 3 | if (__ac_isempty(h->flags, i) && site != h->n_buckets) x = site0 ; \ | 332 | 3 | else x = i; \ | 333 | 3 | } \ | 334 | 3 | } \ | 335 | 5 | } \ | 336 | 5 | if (__ac_isempty(h->flags, x)) { /* not present at all */ \ | 337 | 5 | h->keys[x] = key; \ | 338 | 5 | __ac_set_isboth_false(h->flags, x); \ | 339 | 5 | ++h->size; ++h->n_occupied; \ | 340 | 5 | *ret = 1; \ | 341 | 5 | } else if (0 __ac_isdel0 (h->flags, x)) { /* deleted */ \ | 342 | 0 | h->keys[x] = key; \ | 343 | 0 | __ac_set_isboth_false(h->flags, x); \ | 344 | 0 | ++h->size; \ | 345 | 0 | *ret = 2; \ | 346 | 0 | } else *ret = 0; /* Don't touch h->keys[x] if present and not deleted */ \ | 347 | 5 | return x; \ | 348 | 5 | } \ |
ccv_cnnp_model_core.c:kh_put_model_io Line | Count | Source | 308 | 50 | { \ | 309 | 50 | khint_t x; \ | 310 | 50 | if (h->n_occupied >= h->upper_bound) { /* update the hash table */ \ | 311 | 18 | if (h->n_buckets > (h->size<<1)) { \ | 312 | 0 | if (kh_resize_##name(h, h->n_buckets - 1) < 0) { /* clear "deleted" elements */ \ | 313 | 0 | *ret = -1; return h->n_buckets; \ | 314 | 0 | } \ | 315 | 18 | } else if (kh_resize_##name(h, h->n_buckets + 1) < 0) { /* expand the hash table */ \ | 316 | 0 | *ret = -1; return h->n_buckets; \ | 317 | 0 | } \ | 318 | 18 | } /* TODO: to implement automatically shrinking; resize() already support shrinking */ \ | 319 | 50 | { \ | 320 | 50 | khint_t k, i, site, last, mask = h->n_buckets - 1, step = 0; \ | 321 | 50 | x = site = h->n_buckets; k = __hash_func(key); i = k & mask; \ | 322 | 50 | if (__ac_isempty(h->flags, i)) x = i8 ; /* for speed up */ \ | 323 | 50 | else { \ | 324 | 42 | last = i; \ | 325 | 199 | while (!__ac_isempty(h->flags, i) && (157 __ac_isdel157 (h->flags, i) || !157 __hash_equal157 (h->keys[i], key))) { \ | 326 | 157 | if (__ac_isdel(h->flags, i)) site = i0 ; \ | 327 | 157 | i = (i + (++step)) & mask; \ | 328 | 157 | if (i == last) { x = site; break; }0 \ | 329 | 157 | } \ | 330 | 42 | if (x == h->n_buckets) { \ | 331 | 42 | if (__ac_isempty(h->flags, i) && site != h->n_buckets) x = site0 ; \ | 332 | 42 | else x = i; \ | 333 | 42 | } \ | 334 | 42 | } \ | 335 | 50 | } \ | 336 | 50 | if (__ac_isempty(h->flags, x)) { /* not present at all */ \ | 337 | 50 | h->keys[x] = key; \ | 338 | 50 | __ac_set_isboth_false(h->flags, x); \ | 339 | 50 | ++h->size; ++h->n_occupied; \ | 340 | 50 | *ret = 1; \ | 341 | 50 | } else if (0 __ac_isdel0 (h->flags, x)) { /* deleted */ \ | 342 | 0 | h->keys[x] = key; \ | 343 | 0 | __ac_set_isboth_false(h->flags, x); \ | 344 | 0 | ++h->size; \ | 345 | 0 | *ret = 2; \ | 346 | 0 | } else *ret = 0; /* Don't touch h->keys[x] if present and not deleted */ \ | 347 | 50 | return x; \ | 348 | 50 | } \ |
Unexecuted instantiation: ccv_cnnp_model_core.c:kh_put_stream_map Unexecuted instantiation: ccv_cnnp_model_core.c:kh_put_dy_dev Unexecuted instantiation: ccv_cnnp_model_core.c:kh_put_dy_str Unexecuted instantiation: ccv_cnnp_model_core.c:kh_put_dy_alloc Unexecuted instantiation: ccv_cnnp_model_addons.c:kh_put_stream_map Unexecuted instantiation: ccv_cnnp_model_addons.c:kh_put_dy_dev Unexecuted instantiation: ccv_cnnp_model_addons.c:kh_put_dy_str Unexecuted instantiation: ccv_cnnp_model_addons.c:kh_put_dy_alloc Unexecuted instantiation: ccv_cnnp_model_addons.c:kh_put_ccv_cnnp_model_name_bank Unexecuted instantiation: ccv_nnc_palettize.c:kh_put_stream_map ccv_cnnp_model_gradient_checkpointing.c:kh_put_ccv_cnnp_tensor_symbol_map Line | Count | Source | 308 | 16 | { \ | 309 | 16 | khint_t x; \ | 310 | 16 | if (h->n_occupied >= h->upper_bound) { /* update the hash table */ \ | 311 | 5 | if (h->n_buckets > (h->size<<1)) { \ | 312 | 0 | if (kh_resize_##name(h, h->n_buckets - 1) < 0) { /* clear "deleted" elements */ \ | 313 | 0 | *ret = -1; return h->n_buckets; \ | 314 | 0 | } \ | 315 | 5 | } else if (kh_resize_##name(h, h->n_buckets + 1) < 0) { /* expand the hash table */ \ | 316 | 0 | *ret = -1; return h->n_buckets; \ | 317 | 0 | } \ | 318 | 5 | } /* TODO: to implement automatically shrinking; resize() already support shrinking */ \ | 319 | 16 | { \ | 320 | 16 | khint_t k, i, site, last, mask = h->n_buckets - 1, step = 0; \ | 321 | 16 | x = site = h->n_buckets; k = __hash_func(key); i = k & mask; \ | 322 | 16 | if (__ac_isempty(h->flags, i)) x = i12 ; /* for speed up */ \ | 323 | 16 | else { \ | 324 | 4 | last = i; \ | 325 | 8 | while (!__ac_isempty(h->flags, i) && (4 __ac_isdel4 (h->flags, i) || !4 __hash_equal4 (h->keys[i], key))) { \ | 326 | 4 | if (__ac_isdel(h->flags, i)) site = i0 ; \ | 327 | 4 | i = (i + (++step)) & mask; \ | 328 | 4 | if (i == last) { x = site; break; }0 \ | 329 | 4 | } \ | 330 | 4 | if (x == h->n_buckets) { \ | 331 | 4 | if (__ac_isempty(h->flags, i) && site != h->n_buckets) x = site0 ; \ | 332 | 4 | else x = i; \ | 333 | 4 | } \ | 334 | 4 | } \ | 335 | 16 | } \ | 336 | 16 | if (__ac_isempty(h->flags, x)) { /* not present at all */ \ | 337 | 16 | h->keys[x] = key; \ | 338 | 16 | __ac_set_isboth_false(h->flags, x); \ | 339 | 16 | ++h->size; ++h->n_occupied; \ | 340 | 16 | *ret = 1; \ | 341 | 16 | } else if (0 __ac_isdel0 (h->flags, x)) { /* deleted */ \ | 342 | 0 | h->keys[x] = key; \ | 343 | 0 | __ac_set_isboth_false(h->flags, x); \ | 344 | 0 | ++h->size; \ | 345 | 0 | *ret = 2; \ | 346 | 0 | } else *ret = 0; /* Don't touch h->keys[x] if present and not deleted */ \ | 347 | 16 | return x; \ | 348 | 16 | } \ |
Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:kh_put_stream_map Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:kh_put_dy_dev Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:kh_put_dy_str Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:kh_put_dy_alloc Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:kh_put_ccv_cnnp_model_name_bank |
349 | | SCOPE void kh_del_##name(kh_##name##_t *h, khint_t x) \ |
350 | 771 | { \ |
351 | 771 | if (x != h->n_buckets && !__ac_iseither(h->flags, x)) { \ |
352 | 771 | __ac_set_isdel_true(h->flags, x); \ |
353 | 771 | --h->size; \ |
354 | 771 | } \ |
355 | 771 | } Unexecuted instantiation: while.backward.tests.c:kh_del_stream_map Unexecuted instantiation: tape.tests.c:kh_del_stream_map Unexecuted instantiation: imdb.tests.c:kh_del_vocab_map Unexecuted instantiation: ccv_nnc_cmd.c:kh_del_stream_map Unexecuted instantiation: ccv_nnc_tensor.c:kh_del_stream_map Unexecuted instantiation: ccv_nnc_tensor_io.c:kh_del_stream_map Unexecuted instantiation: ccv_nnc_stream.c:kh_del_stream_map Unexecuted instantiation: ccv_nnc_micro.c:kh_del_ccv_nnc_micro_bind_scalar Unexecuted instantiation: ccv_nnc_micro.c:kh_del_ccv_nnc_ids Unexecuted instantiation: ccv_nnc_micro_simplify.c:kh_del_ccv_nnc_axis_id_group Unexecuted instantiation: ccv_nnc_graph.c:kh_del_stream_map Unexecuted instantiation: ccv_nnc_symbolic_graph_io.c:kh_del_stream_map Unexecuted instantiation: ccv_nnc_symbolic_graph_compile.c:kh_del_stream_map Unexecuted instantiation: ccv_nnc_symbolic_graph_compile.c:kh_del_obj_ptr Unexecuted instantiation: ccv_nnc_graph_while.c:kh_del_stream_map Unexecuted instantiation: ccv_nnc_tensor_tape.c:kh_del_stream_map Unexecuted instantiation: ccv_nnc_graph_case_of.c:kh_del_stream_map Unexecuted instantiation: ccv_nnc_graph_run.c:kh_del_stream_map ccv_nnc_xpu_alloc.c:kh_del_dy_str Line | Count | Source | 350 | 2 | { \ | 351 | 2 | if (x != h->n_buckets && !__ac_iseither(h->flags, x)) { \ | 352 | 2 | __ac_set_isdel_true(h->flags, x); \ | 353 | 2 | --h->size; \ | 354 | 2 | } \ | 355 | 2 | } |
ccv_nnc_xpu_alloc.c:kh_del_dy_alloc Line | Count | Source | 350 | 723 | { \ | 351 | 723 | if (x != h->n_buckets && !__ac_iseither(h->flags, x)) { \ | 352 | 723 | __ac_set_isdel_true(h->flags, x); \ | 353 | 723 | --h->size; \ | 354 | 723 | } \ | 355 | 723 | } |
ccv_nnc_xpu_alloc.c:kh_del_dy_dev Line | Count | Source | 350 | 42 | { \ | 351 | 42 | if (x != h->n_buckets && !__ac_iseither(h->flags, x)) { \ | 352 | 42 | __ac_set_isdel_true(h->flags, x); \ | 353 | 42 | --h->size; \ | 354 | 42 | } \ | 355 | 42 | } |
Unexecuted instantiation: ccv_nnc_xpu_alloc.c:kh_del_stream_map Unexecuted instantiation: ccv_nnc_dynamic_graph.c:kh_del_stream_map Unexecuted instantiation: ccv_nnc_dynamic_graph.c:kh_del_dy_dev Unexecuted instantiation: ccv_nnc_dynamic_graph.c:kh_del_dy_str Unexecuted instantiation: ccv_nnc_dynamic_graph.c:kh_del_dy_alloc Unexecuted instantiation: ccv_nnc_dynamic_graph.c:kh_del_stateful_exec Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:kh_del_stream_map Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:kh_del_dy_dev Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:kh_del_dy_str Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:kh_del_dy_alloc Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:kh_del_stateful_exec Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:kh_del_stream_map Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:kh_del_dy_dev Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:kh_del_dy_str Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:kh_del_dy_alloc Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:kh_del_stateful_exec Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:kh_del_stream_map Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:kh_del_dy_dev Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:kh_del_dy_str Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:kh_del_dy_alloc Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:kh_del_stateful_exec Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:kh_del_stream_map Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:kh_del_dy_dev Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:kh_del_dy_str Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:kh_del_dy_alloc Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:kh_del_stateful_exec Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:kh_del_stream_map Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:kh_del_dy_dev Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:kh_del_dy_str Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:kh_del_dy_alloc Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:kh_del_stateful_exec Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:kh_del_ccv_cnnp_model_name_bank ccv_cnnp_dataframe.c:kh_del_ctx Line | Count | Source | 350 | 4 | { \ | 351 | 4 | if (x != h->n_buckets && !__ac_iseither(h->flags, x)) { \ | 352 | 4 | __ac_set_isdel_true(h->flags, x); \ | 353 | 4 | --h->size; \ | 354 | 4 | } \ | 355 | 4 | } |
Unexecuted instantiation: ccv_cnnp_dataframe.c:kh_del_iter_ctx Unexecuted instantiation: ccv_cnnp_model.c:kh_del_stream_map Unexecuted instantiation: ccv_cnnp_model.c:kh_del_dy_dev Unexecuted instantiation: ccv_cnnp_model.c:kh_del_dy_str Unexecuted instantiation: ccv_cnnp_model.c:kh_del_dy_alloc Unexecuted instantiation: ccv_cnnp_model.c:kh_del_ccv_cnnp_model_name_bank Unexecuted instantiation: ccv_cnnp_model.c:kh_del_ccv_cnnp_parameter_id Unexecuted instantiation: ccv_cnnp_model_io.c:kh_del_stream_map Unexecuted instantiation: ccv_cnnp_model_io.c:kh_del_dy_dev Unexecuted instantiation: ccv_cnnp_model_io.c:kh_del_dy_str Unexecuted instantiation: ccv_cnnp_model_io.c:kh_del_dy_alloc Unexecuted instantiation: ccv_cnnp_model_io.c:kh_del_ccv_cnnp_model_name_bank Unexecuted instantiation: ccv_cnnp_model_core.c:kh_del_stream_map Unexecuted instantiation: ccv_cnnp_model_core.c:kh_del_dy_dev Unexecuted instantiation: ccv_cnnp_model_core.c:kh_del_dy_str Unexecuted instantiation: ccv_cnnp_model_core.c:kh_del_dy_alloc Unexecuted instantiation: ccv_cnnp_model_core.c:kh_del_ccv_cnnp_model_name_bank Unexecuted instantiation: ccv_cnnp_model_core.c:kh_del_model Unexecuted instantiation: ccv_cnnp_model_core.c:kh_del_io_node Unexecuted instantiation: ccv_cnnp_model_core.c:kh_del_model_io Unexecuted instantiation: ccv_cnnp_model_addons.c:kh_del_stream_map Unexecuted instantiation: ccv_cnnp_model_addons.c:kh_del_dy_dev Unexecuted instantiation: ccv_cnnp_model_addons.c:kh_del_dy_str Unexecuted instantiation: ccv_cnnp_model_addons.c:kh_del_dy_alloc Unexecuted instantiation: ccv_cnnp_model_addons.c:kh_del_ccv_cnnp_model_name_bank Unexecuted instantiation: ccv_nnc_palettize.c:kh_del_stream_map Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:kh_del_stream_map Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:kh_del_dy_dev Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:kh_del_dy_str Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:kh_del_dy_alloc Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:kh_del_ccv_cnnp_model_name_bank Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:kh_del_ccv_cnnp_tensor_symbol_map |
356 | | |
357 | | #define KHASH_DECLARE(name, khkey_t, khval_t) \ |
358 | | __KHASH_TYPE(name, khkey_t, khval_t) \ |
359 | | __KHASH_PROTOTYPES(name, khkey_t, khval_t) |
360 | | |
361 | | #define KHASH_INIT2(name, SCOPE, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal) \ |
362 | | __KHASH_TYPE(name, khkey_t, khval_t) \ |
363 | | __KHASH_IMPL(name, SCOPE, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal) |
364 | | |
365 | | #define KHASH_INIT(name, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal) \ |
366 | | KHASH_INIT2(name, static kh_inline klib_unused, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal) |
367 | | |
368 | | /* --- BEGIN OF HASH FUNCTIONS --- */ |
369 | | |
370 | | /*! @function |
371 | | @abstract Integer hash function |
372 | | @param key The integer [khint32_t] |
373 | | @return The hash value [khint_t] |
374 | | */ |
375 | 2.35k | #define kh_int_hash_func(key) (khint32_t)(key) |
376 | | /*! @function |
377 | | @abstract Integer comparison function |
378 | | */ |
379 | 1.65k | #define kh_int_hash_equal(a, b) ((a) == (b)) |
380 | | /*! @function |
381 | | @abstract 64-bit integer hash function |
382 | | @param key The integer [khint64_t] |
383 | | @return The hash value [khint_t] |
384 | | */ |
385 | 2.60M | #define kh_int64_hash_func(key) (khint32_t)((key)>>33^(key)^(key)<<11) |
386 | | /*! @function |
387 | | @abstract 64-bit integer comparison function |
388 | | */ |
389 | 3.72M | #define kh_int64_hash_equal(a, b) ((a) == (b)) |
390 | | /*! @function |
391 | | @abstract const char* hash function |
392 | | @param s Pointer to a null terminated string |
393 | | @return The hash value |
394 | | */ |
395 | | static kh_inline khint_t __ac_X31_hash_string(const char *s) |
396 | 758k | { |
397 | 758k | khint_t h = (khint_t)*s; |
398 | 5.28M | if (h758k ) for (++s ; 756k *s; ++s4.53M ) h = (h << 5) - h + (khint_t)*s4.53M ; |
399 | 758k | return h; |
400 | 758k | } Unexecuted instantiation: while.backward.tests.c:__ac_X31_hash_string Unexecuted instantiation: tape.tests.c:__ac_X31_hash_string imdb.tests.c:__ac_X31_hash_string Line | Count | Source | 396 | 756k | { | 397 | 756k | khint_t h = (khint_t)*s; | 398 | 5.28M | if (h756k ) for (++s ; 756k *s; ++s4.53M ) h = (h << 5) - h + (khint_t)*s4.53M ; | 399 | 756k | return h; | 400 | 756k | } |
Unexecuted instantiation: ccv_nnc_cmd.c:__ac_X31_hash_string Unexecuted instantiation: ccv_nnc_tensor.c:__ac_X31_hash_string Unexecuted instantiation: ccv_nnc_tensor_io.c:__ac_X31_hash_string Unexecuted instantiation: ccv_nnc_stream.c:__ac_X31_hash_string ccv_nnc_micro.c:__ac_X31_hash_string Line | Count | Source | 396 | 13 | { | 397 | 13 | khint_t h = (khint_t)*s; | 398 | 39 | if (h13 ) for (++s ; 13 *s; ++s26 ) h = (h << 5) - h + (khint_t)*s26 ; | 399 | 13 | return h; | 400 | 13 | } |
Unexecuted instantiation: ccv_nnc_micro_core.c:__ac_X31_hash_string Unexecuted instantiation: ccv_nnc_micro_simplify.c:__ac_X31_hash_string Unexecuted instantiation: ccv_nnc_graph.c:__ac_X31_hash_string Unexecuted instantiation: ccv_nnc_symbolic_graph_io.c:__ac_X31_hash_string Unexecuted instantiation: ccv_nnc_symbolic_graph_compile.c:__ac_X31_hash_string Unexecuted instantiation: ccv_nnc_graph_while.c:__ac_X31_hash_string Unexecuted instantiation: ccv_nnc_tensor_tape.c:__ac_X31_hash_string Unexecuted instantiation: ccv_nnc_graph_case_of.c:__ac_X31_hash_string Unexecuted instantiation: ccv_nnc_graph_run.c:__ac_X31_hash_string Unexecuted instantiation: ccv_nnc_xpu_alloc.c:__ac_X31_hash_string Unexecuted instantiation: ccv_nnc_dynamic_graph.c:__ac_X31_hash_string Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:__ac_X31_hash_string Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:__ac_X31_hash_string Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:__ac_X31_hash_string Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:__ac_X31_hash_string Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:__ac_X31_hash_string Unexecuted instantiation: ccv_cnnp_dataframe.c:__ac_X31_hash_string ccv_cnnp_model.c:__ac_X31_hash_string Line | Count | Source | 396 | 1.24k | { | 397 | 1.24k | khint_t h = (khint_t)*s; | 398 | 1.24k | if (h) for (++s ; 37 *s295 ; ++s258 ) h = (h << 5) - h + (khint_t)*s258 ; | 399 | 1.24k | return h; | 400 | 1.24k | } |
Unexecuted instantiation: ccv_cnnp_model_io.c:__ac_X31_hash_string ccv_cnnp_model_core.c:__ac_X31_hash_string Line | Count | Source | 396 | 1.57k | { | 397 | 1.57k | khint_t h = (khint_t)*s; | 398 | 1.63k | if (h1.57k ) for (++s ; 290 *s; ++s1.34k ) h = (h << 5) - h + (khint_t)*s1.34k ; | 399 | 1.57k | return h; | 400 | 1.57k | } |
Unexecuted instantiation: ccv_cnnp_model_addons.c:__ac_X31_hash_string Unexecuted instantiation: ccv_nnc_palettize.c:__ac_X31_hash_string Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:__ac_X31_hash_string |
401 | | /*! @function |
402 | | @abstract Another interface to const char* hash function |
403 | | @param key Pointer to a null terminated string [const char*] |
404 | | @return The hash value [khint_t] |
405 | | */ |
406 | 758k | #define kh_str_hash_func(key) __ac_X31_hash_string(key) |
407 | | /*! @function |
408 | | @abstract Const char* comparison function |
409 | | */ |
410 | 927k | #define kh_str_hash_equal(a, b) (strcmp(a, b) == 0) |
411 | | |
412 | | static kh_inline khint_t __ac_Wang_hash(khint_t key) |
413 | 0 | { |
414 | 0 | key += ~(key << 15); |
415 | 0 | key ^= (key >> 10); |
416 | 0 | key += (key << 3); |
417 | 0 | key ^= (key >> 6); |
418 | 0 | key += ~(key << 11); |
419 | 0 | key ^= (key >> 16); |
420 | 0 | return key; |
421 | 0 | } Unexecuted instantiation: while.backward.tests.c:__ac_Wang_hash Unexecuted instantiation: tape.tests.c:__ac_Wang_hash Unexecuted instantiation: imdb.tests.c:__ac_Wang_hash Unexecuted instantiation: ccv_nnc_cmd.c:__ac_Wang_hash Unexecuted instantiation: ccv_nnc_tensor.c:__ac_Wang_hash Unexecuted instantiation: ccv_nnc_tensor_io.c:__ac_Wang_hash Unexecuted instantiation: ccv_nnc_stream.c:__ac_Wang_hash Unexecuted instantiation: ccv_nnc_micro.c:__ac_Wang_hash Unexecuted instantiation: ccv_nnc_micro_core.c:__ac_Wang_hash Unexecuted instantiation: ccv_nnc_micro_simplify.c:__ac_Wang_hash Unexecuted instantiation: ccv_nnc_graph.c:__ac_Wang_hash Unexecuted instantiation: ccv_nnc_symbolic_graph_io.c:__ac_Wang_hash Unexecuted instantiation: ccv_nnc_symbolic_graph_compile.c:__ac_Wang_hash Unexecuted instantiation: ccv_nnc_graph_while.c:__ac_Wang_hash Unexecuted instantiation: ccv_nnc_tensor_tape.c:__ac_Wang_hash Unexecuted instantiation: ccv_nnc_graph_case_of.c:__ac_Wang_hash Unexecuted instantiation: ccv_nnc_graph_run.c:__ac_Wang_hash Unexecuted instantiation: ccv_nnc_xpu_alloc.c:__ac_Wang_hash Unexecuted instantiation: ccv_nnc_dynamic_graph.c:__ac_Wang_hash Unexecuted instantiation: ccv_nnc_dynamic_graph_alloc.c:__ac_Wang_hash Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:__ac_Wang_hash Unexecuted instantiation: ccv_nnc_dynamic_graph_apply_gradients.c:__ac_Wang_hash Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:__ac_Wang_hash Unexecuted instantiation: ccv_nnc_dynamic_graph_evaluate.c:__ac_Wang_hash Unexecuted instantiation: ccv_cnnp_dataframe.c:__ac_Wang_hash Unexecuted instantiation: ccv_cnnp_model.c:__ac_Wang_hash Unexecuted instantiation: ccv_cnnp_model_io.c:__ac_Wang_hash Unexecuted instantiation: ccv_cnnp_model_core.c:__ac_Wang_hash Unexecuted instantiation: ccv_cnnp_model_addons.c:__ac_Wang_hash Unexecuted instantiation: ccv_nnc_palettize.c:__ac_Wang_hash Unexecuted instantiation: ccv_cnnp_model_gradient_checkpointing.c:__ac_Wang_hash |
422 | | #define kh_int_hash_func2(key) __ac_Wang_hash((khint_t)key) |
423 | | |
424 | | /* --- END OF HASH FUNCTIONS --- */ |
425 | | |
426 | | /* Other convenient macros... */ |
427 | | |
428 | | /*! |
429 | | @abstract Type of the hash table. |
430 | | @param name Name of the hash table [symbol] |
431 | | */ |
432 | 2.61M | #define khash_t(name) kh_##name##_t |
433 | | |
434 | | /*! @function |
435 | | @abstract Initiate a hash table. |
436 | | @param name Name of the hash table [symbol] |
437 | | @return Pointer to the hash table [khash_t(name)*] |
438 | | */ |
439 | 10.9k | #define kh_init(name) kh_init_##name()1.00k |
440 | | |
441 | | /*! @function |
442 | | @abstract Destroy a hash table. |
443 | | @param name Name of the hash table [symbol] |
444 | | @param h Pointer to the hash table [khash_t(name)*] |
445 | | */ |
446 | 10.9k | #define kh_destroy(name, h) kh_destroy_##name(h)1.07k |
447 | | |
448 | | /*! @function |
449 | | @abstract Reset a hash table without deallocating memory. |
450 | | @param name Name of the hash table [symbol] |
451 | | @param h Pointer to the hash table [khash_t(name)*] |
452 | | */ |
453 | | #define kh_clear(name, h) kh_clear_##name(h) |
454 | | |
455 | | /*! @function |
456 | | @abstract Resize a hash table. |
457 | | @param name Name of the hash table [symbol] |
458 | | @param h Pointer to the hash table [khash_t(name)*] |
459 | | @param s New size [khint_t] |
460 | | */ |
461 | | #define kh_resize(name, h, s) kh_resize_##name(h, s) |
462 | | |
463 | | /*! @function |
464 | | @abstract Insert a key to the hash table. |
465 | | @param name Name of the hash table [symbol] |
466 | | @param h Pointer to the hash table [khash_t(name)*] |
467 | | @param k Key [type of keys] |
468 | | @param r Extra return code: -1 if the operation failed; |
469 | | 0 if the key is present in the hash table; |
470 | | 1 if the bucket is empty (never used); 2 if the element in |
471 | | the bucket has been deleted [int*] |
472 | | @return Iterator to the inserted element [khint_t] |
473 | | */ |
474 | 458k | #define kh_put(name, h, k, r) kh_put_##name(h, k5.43k , r) |
475 | | |
476 | | /*! @function |
477 | | @abstract Retrieve a key from the hash table. |
478 | | @param name Name of the hash table [symbol] |
479 | | @param h Pointer to the hash table [khash_t(name)*] |
480 | | @param k Key [type of keys] |
481 | | @return Iterator to the found element, or kh_end(h) if the element is absent [khint_t] |
482 | | */ |
483 | 2.60M | #define kh_get(name, h, k) kh_get_##name(h, k) |
484 | | |
485 | | /*! @function |
486 | | @abstract Remove a key from the hash table. |
487 | | @param name Name of the hash table [symbol] |
488 | | @param h Pointer to the hash table [khash_t(name)*] |
489 | | @param k Iterator to the element to be deleted [khint_t] |
490 | | */ |
491 | 771 | #define kh_del(name, h, k) kh_del_##name(h, k) |
492 | | |
493 | | /*! @function |
494 | | @abstract Test whether a bucket contains data. |
495 | | @param h Pointer to the hash table [khash_t(name)*] |
496 | | @param x Iterator to the bucket [khint_t] |
497 | | @return 1 if containing data; 0 otherwise [int] |
498 | | */ |
499 | 394k | #define kh_exist(h, x) (!__ac_iseither((h)->flags, (x))) |
500 | | |
501 | | /*! @function |
502 | | @abstract Get key given an iterator |
503 | | @param h Pointer to the hash table [khash_t(name)*] |
504 | | @param x Iterator to the bucket [khint_t] |
505 | | @return Key [type of keys] |
506 | | */ |
507 | 268k | #define kh_key(h, x) ((h)->keys[x]) |
508 | | |
509 | | /*! @function |
510 | | @abstract Get value given an iterator |
511 | | @param h Pointer to the hash table [khash_t(name)*] |
512 | | @param x Iterator to the bucket [khint_t] |
513 | | @return Value [type of values] |
514 | | @discussion For hash sets, calling this results in segfault. |
515 | | */ |
516 | 2.86M | #define kh_val(h, x) ((h)->vals[x]) |
517 | | |
518 | | /*! @function |
519 | | @abstract Alias of kh_val() |
520 | | */ |
521 | | #define kh_value(h, x) ((h)->vals[x]) |
522 | | |
523 | | /*! @function |
524 | | @abstract Get the start iterator |
525 | | @param h Pointer to the hash table [khash_t(name)*] |
526 | | @return The start iterator [khint_t] |
527 | | */ |
528 | 4.88k | #define kh_begin(h) (khint_t)(0) |
529 | | |
530 | | /*! @function |
531 | | @abstract Get the end iterator |
532 | | @param h Pointer to the hash table [khash_t(name)*] |
533 | | @return The end iterator [khint_t] |
534 | | */ |
535 | 2.99M | #define kh_end(h) ((h)->n_buckets) |
536 | | |
537 | | /*! @function |
538 | | @abstract Get the number of elements in the hash table |
539 | | @param h Pointer to the hash table [khash_t(name)*] |
540 | | @return Number of elements in the hash table [khint_t] |
541 | | */ |
542 | | #define kh_size(h) ((h)->size) |
543 | | |
544 | | /*! @function |
545 | | @abstract Get the number of buckets in the hash table |
546 | | @param h Pointer to the hash table [khash_t(name)*] |
547 | | @return Number of buckets in the hash table [khint_t] |
548 | | */ |
549 | | #define kh_n_buckets(h) ((h)->n_buckets) |
550 | | |
551 | | /*! @function |
552 | | @abstract Iterate over the entries in the hash table |
553 | | @param h Pointer to the hash table [khash_t(name)*] |
554 | | @param kvar Variable to which key will be assigned |
555 | | @param vvar Variable to which value will be assigned |
556 | | @param code Block of code to execute |
557 | | */ |
558 | | #define kh_foreach(h, kvar, vvar, code) { khint_t __i; \ |
559 | | for (__i = kh_begin(h); __i != kh_end(h); ++__i) { \ |
560 | | if (!kh_exist(h,__i)) continue; \ |
561 | | (kvar) = kh_key(h,__i); \ |
562 | | (vvar) = kh_val(h,__i); \ |
563 | | code; \ |
564 | | } } |
565 | | |
566 | | /*! @function |
567 | | @abstract Iterate over the values in the hash table |
568 | | @param h Pointer to the hash table [khash_t(name)*] |
569 | | @param vvar Variable to which value will be assigned |
570 | | @param code Block of code to execute |
571 | | */ |
572 | | #define kh_foreach_value(h, vvar, code) { khint_t __i; \ |
573 | | for (__i = kh_begin(h); __i != kh_end(h); ++__i) { \ |
574 | | if (!kh_exist(h,__i)) continue; \ |
575 | | (vvar) = kh_val(h,__i); \ |
576 | | code; \ |
577 | | } } |
578 | | |
579 | | /* More convenient interfaces */ |
580 | | |
581 | | /*! @function |
582 | | @abstract Instantiate a hash set containing integer keys |
583 | | @param name Name of the hash table [symbol] |
584 | | */ |
585 | | #define KHASH_SET_INIT_INT(name) \ |
586 | | KHASH_INIT(name, khint32_t, char, 0, kh_int_hash_func, kh_int_hash_equal) |
587 | | |
588 | | /*! @function |
589 | | @abstract Instantiate a hash map containing integer keys |
590 | | @param name Name of the hash table [symbol] |
591 | | @param khval_t Type of values [type] |
592 | | */ |
593 | | #define KHASH_MAP_INIT_INT(name, khval_t) \ |
594 | 2.35k | KHASH_INIT(name, khint32_t, khval_t, 1, kh_int_hash_func, kh_int_hash_equal1.65k ) |
595 | | |
596 | | /*! @function |
597 | | @abstract Instantiate a hash set containing 64-bit integer keys |
598 | | @param name Name of the hash table [symbol] |
599 | | */ |
600 | | #define KHASH_SET_INIT_INT64(name) \ |
601 | 9 | KHASH_INIT(name, khint64_t, char, 0, kh_int64_hash_func, kh_int64_hash_equal) |
602 | | |
603 | | /*! @function |
604 | | @abstract Instantiate a hash map containing 64-bit integer keys |
605 | | @param name Name of the hash table [symbol] |
606 | | @param khval_t Type of values [type] |
607 | | */ |
608 | | #define KHASH_MAP_INIT_INT64(name, khval_t) \ |
609 | 3.72M | KHASH_INIT(name, khint64_t, khval_t, 1, kh_int64_hash_func2.60M , kh_int64_hash_equal) |
610 | | |
611 | | typedef const char *kh_cstr_t; |
612 | | /*! @function |
613 | | @abstract Instantiate a hash map containing const char* keys |
614 | | @param name Name of the hash table [symbol] |
615 | | */ |
616 | | #define KHASH_SET_INIT_STR(name) \ |
617 | | KHASH_INIT(name, kh_cstr_t, char, 0, kh_str_hash_func, kh_str_hash_equal) |
618 | | |
619 | | /*! @function |
620 | | @abstract Instantiate a hash map containing const char* keys |
621 | | @param name Name of the hash table [symbol] |
622 | | @param khval_t Type of values [type] |
623 | | */ |
624 | | #define KHASH_MAP_INIT_STR(name, khval_t) \ |
625 | 927k | KHASH_INIT(name, kh_cstr_t, khval_t, 1, kh_str_hash_func758k , kh_str_hash_equal) |
626 | | |
627 | | #endif /* __AC_KHASH_H */ |