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

Function seen_set_insert

src/simhash/minhash.c:413–429  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

411}
412
413static bool seen_set_insert(seen_set_t *s, int64_t node_id) {
414 if (!s->slots) {
415 return false;
416 }
417 uint32_t idx = (uint32_t)(node_id * KNUTH_MULT) & SEEN_SET_MASK;
418 for (int probe = 0; probe < SEEN_SET_SIZE; probe++) {
419 uint32_t slot = (idx + (uint32_t)probe) & SEEN_SET_MASK;
420 if (s->slots[slot] == 0) {
421 s->slots[slot] = node_id;
422 return true; /* inserted (was not present) */
423 }
424 if (s->slots[slot] == node_id) {
425 return false; /* already present */
426 }
427 }
428 return false; /* table full */
429}
430
431static void seen_set_free(seen_set_t *s) {
432 free(s->slots);

Callers 2

cbm_lsh_queryFunction · 0.85
cbm_lsh_query_intoFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected