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

Function get_varint

internal/cbm/sqlite_writer.c:1110–1122  ·  view source on GitHub ↗

Read a SQLite varint (1-9 bytes). Returns bytes consumed.

Source from the content-addressed store, hash-verified

1108
1109// Read a SQLite varint (1-9 bytes). Returns bytes consumed.
1110static int get_varint(const uint8_t *buf, uint64_t *out) {
1111 uint64_t v = 0;
1112 for (int i = 0; i < 8; i++) {
1113 v = (v << 7) | (uint64_t)(buf[i] & 0x7f);
1114 if ((buf[i] & 0x80) == 0) {
1115 *out = v;
1116 return i + 1;
1117 }
1118 }
1119 v = (v << 8) | (uint64_t)buf[8];
1120 *out = v;
1121 return 9;
1122}
1123
1124// If an index cell's payload exceeds X, rewrite it to spill the tail to
1125// overflow pages: varint(payload_len) + payload[0..local) + u32(first_ovfl).

Callers 1

overflowize_index_cellFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected