| 251 | } |
| 252 | |
| 253 | static size_t ggml_hash_find(const struct ggml_hash_set * hash_set, const struct ggml_tensor * key) { |
| 254 | size_t h = ggml_hash(key) % hash_set->size; |
| 255 | |
| 256 | // linear probing |
| 257 | size_t i = h; |
| 258 | while (ggml_bitset_get(hash_set->used, i) && hash_set->keys[i] != key) { |
| 259 | i = (i + 1) % hash_set->size; |
| 260 | if (i == h) { |
| 261 | // visited all hash table entries -> not found |
| 262 | return GGML_HASHSET_FULL; |
| 263 | } |
| 264 | } |
| 265 | return i; |
| 266 | } |
| 267 | |
| 268 | static bool ggml_hash_contains(const struct ggml_hash_set * hash_set, struct ggml_tensor * key) { |
| 269 | size_t i = ggml_hash_find(hash_set, key); |
no test coverage detected