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

Function get_varint

internal/cbm/sqlite_writer.c:1088–1100  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1086
1087// Read a SQLite varint (1-9 bytes). Returns bytes consumed.
1088static int get_varint(const uint8_t *buf, uint64_t *out) {
1089 uint64_t v = 0;
1090 for (int i = 0; i < 8; i++) {
1091 v = (v << 7) | (uint64_t)(buf[i] & 0x7f);
1092 if ((buf[i] & 0x80) == 0) {
1093 *out = v;
1094 return i + 1;
1095 }
1096 }
1097 v = (v << 8) | (uint64_t)buf[8];
1098 *out = v;
1099 return 9;
1100}
1101
1102// If an index cell's payload exceeds X, rewrite it to spill the tail to
1103// 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