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

Function seen_set_insert

src/simhash/minhash.c:434–450  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

432}
433
434static bool seen_set_insert(seen_set_t *s, int64_t node_id) {
435 if (!s->slots) {
436 return false;
437 }
438 uint32_t idx = (uint32_t)(node_id * KNUTH_MULT) & SEEN_SET_MASK;
439 for (int probe = 0; probe < SEEN_SET_SIZE; probe++) {
440 uint32_t slot = (idx + (uint32_t)probe) & SEEN_SET_MASK;
441 if (s->slots[slot] == 0) {
442 s->slots[slot] = node_id;
443 return true; /* inserted (was not present) */
444 }
445 if (s->slots[slot] == node_id) {
446 return false; /* already present */
447 }
448 }
449 return false; /* table full */
450}
451
452static void seen_set_free(seen_set_t *s) {
453 cbm_free(CBM_MEM_CLASS_SEMANTIC, s->slots);

Callers 1

cbm_lsh_queryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected