| 15173 | } |
| 15174 | |
| 15175 | size_t ggml_hash_find(const struct ggml_hash_set hash_set, struct ggml_tensor * key) { |
| 15176 | size_t h = ggml_hash(key) % hash_set.size; |
| 15177 | |
| 15178 | // linear probing |
| 15179 | size_t i = h; |
| 15180 | while (hash_set.keys[i] != NULL && hash_set.keys[i] != key) { |
| 15181 | i = (i + 1) % hash_set.size; |
| 15182 | if (i == h) { |
| 15183 | // visited all hash table entries -> not found |
| 15184 | return GGML_HASHTABLE_FULL; |
| 15185 | } |
| 15186 | } |
| 15187 | return i; |
| 15188 | } |
| 15189 | |
| 15190 | bool ggml_hash_contains(struct ggml_hash_set hash_set, struct ggml_tensor * key) { |
| 15191 | size_t i = ggml_hash_find(hash_set, key); |
no test coverage detected