MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / bucket_push

Function bucket_push

src/simhash/minhash.c:355–366  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

353}
354
355static void bucket_push(lsh_bucket_t *bucket, int entry_index) {
356 if (bucket->count >= bucket->cap) {
357 int new_cap = bucket->cap < BUCKET_INIT_CAP ? BUCKET_INIT_CAP : bucket->cap * GROW_FACTOR;
358 int *new_items = realloc(bucket->items, (size_t)new_cap * sizeof(int));
359 if (!new_items) {
360 return;
361 }
362 bucket->items = new_items;
363 bucket->cap = new_cap;
364 }
365 bucket->items[bucket->count++] = entry_index;
366}
367
368cbm_lsh_index_t *cbm_lsh_new(void) {
369 cbm_lsh_index_t *idx = calloc(SKIP_ONE, sizeof(cbm_lsh_index_t));

Callers 1

cbm_lsh_insertFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected