| 372 | } |
| 373 | |
| 374 | static void bucket_push(lsh_bucket_t *bucket, int entry_index) { |
| 375 | if (bucket->count >= bucket->cap) { |
| 376 | int new_cap = bucket->cap < BUCKET_INIT_CAP ? BUCKET_INIT_CAP : bucket->cap * GROW_FACTOR; |
| 377 | int *new_items = |
| 378 | cbm_realloc(CBM_MEM_CLASS_SEMANTIC, bucket->items, (size_t)new_cap * sizeof(int)); |
| 379 | if (!new_items) { |
| 380 | return; |
| 381 | } |
| 382 | bucket->items = new_items; |
| 383 | bucket->cap = new_cap; |
| 384 | } |
| 385 | bucket->items[bucket->count++] = entry_index; |
| 386 | } |
| 387 | |
| 388 | cbm_lsh_index_t *cbm_lsh_new(void) { |
| 389 | cbm_lsh_index_t *idx = |
no test coverage detected