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

Function band_hash

src/simhash/minhash.c:344–353  ·  view source on GitHub ↗

Compute band hash for band `b` from a MinHash signature. * Uses r=2 consecutive values starting at position b*r. */

Source from the content-addressed store, hash-verified

342/* Compute band hash for band `b` from a MinHash signature.
343 * Uses r=2 consecutive values starting at position b*r. */
344static uint32_t band_hash(const cbm_minhash_t *fp, int band) {
345 int base = band * CBM_LSH_ROWS;
346 /* Combine r=2 values into a single hash */
347 uint32_t combined[CBM_LSH_ROWS];
348 for (int r = 0; r < CBM_LSH_ROWS; r++) {
349 combined[r] = fp->values[base + r];
350 }
351 uint64_t h = XXH3_64bits(combined, sizeof(combined));
352 return (uint32_t)(h & LSH_BUCKET_MASK);
353}
354
355static void bucket_push(lsh_bucket_t *bucket, int entry_index) {
356 if (bucket->count >= bucket->cap) {

Callers 3

cbm_lsh_insertFunction · 0.85
cbm_lsh_queryFunction · 0.85
cbm_lsh_query_intoFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected