| 536 | } |
| 537 | |
| 538 | static 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 | |
| 554 | int 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) { |
no outgoing calls
no test coverage detected