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

Function te_hex_bytes

src/mcp/test_impact_engine.c:410–430  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

408/* ── The answer ──────────────────────────────────────────────────── */
409
410static bool te_hex_bytes(const char *hex, unsigned char *out, size_t count) {
411 if (!hex || strlen(hex) != count * 2) {
412 return false;
413 }
414 for (size_t i = 0; i < count; i++) {
415 unsigned v = 0;
416 for (int k = 0; k < 2; k++) {
417 char ch = hex[i * 2 + (size_t)k];
418 unsigned d = ch >= '0' && ch <= '9' ? (unsigned)(ch - '0')
419 : ch >= 'a' && ch <= 'f' ? (unsigned)(ch - 'a' + 10)
420 : ch >= 'A' && ch <= 'F' ? (unsigned)(ch - 'A' + 10)
421 : 16U;
422 if (d > 15) {
423 return false;
424 }
425 v = v * 16 + d;
426 }
427 out[i] = (unsigned char)v;
428 }
429 return true;
430}
431
432static cbm_test_result_oid_t te_oid(const te_ctx_t *c, const char *hex) {
433 cbm_test_result_oid_t oid = {0};

Callers 2

te_oidFunction · 0.85
te_digest_hexFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected