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

Function lsh_seen_insert

src/simhash/minhash.c:538–552  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

536}
537
538static bool lsh_seen_insert(cbm_lsh_seen_t *s, int64_t node_id) {
539 uint32_t idx = (uint32_t)(node_id * KNUTH_MULT) & SEEN_SET_MASK;
540 for (int probe = 0; probe < SEEN_SET_SIZE; probe++) {
541 uint32_t slot = (idx + (uint32_t)probe) & SEEN_SET_MASK;
542 if (s->stamp[slot] != s->current) {
543 s->stamp[slot] = s->current;
544 s->ids[slot] = node_id;
545 return true; /* inserted (was not present) */
546 }
547 if (s->ids[slot] == node_id) {
548 return false; /* already present */
549 }
550 }
551 return false; /* table full */
552}
553
554int cbm_lsh_query_into_seen(const cbm_lsh_index_t *idx, const cbm_minhash_t *fp,
555 const cbm_lsh_entry_t **out_buf, int out_cap, cbm_lsh_seen_t *seen) {

Callers 1

cbm_lsh_query_into_seenFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected