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

Function cbm_minhash_from_hex

src/simhash/minhash.c:297–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

295}
296
297bool cbm_minhash_from_hex(const char *hex, cbm_minhash_t *out) {
298 if (!hex || !out) {
299 return false;
300 }
301 size_t len = strlen(hex);
302 if ((int)len != CBM_MINHASH_HEX_LEN) {
303 return false;
304 }
305 for (int i = 0; i < CBM_MINHASH_K; i++) {
306 char chunk[HEX_CHARS_PER_U32 + SKIP_ONE];
307 ptrdiff_t offset = (ptrdiff_t)i * HEX_CHARS_PER_U32;
308 memcpy(chunk, hex + offset, HEX_CHARS_PER_U32);
309 chunk[HEX_CHARS_PER_U32] = '\0';
310 unsigned long val = strtoul(chunk, NULL, HEX_BASE);
311 out->values[i] = (uint32_t)val;
312 }
313 return true;
314}
315
316/* ── LSH index ───────────────────────────────────────────────────── */
317

Callers 3

decode_minhashFunction · 0.85
parse_fp_from_propsFunction · 0.85
test_simhash.cFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected