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

Function get_varint

internal/cbm/sqlite_writer.c:1067–1079  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1065
1066// Read a SQLite varint (1-9 bytes). Returns bytes consumed.
1067static int get_varint(const uint8_t *buf, uint64_t *out) {
1068 uint64_t v = 0;
1069 for (int i = 0; i < 8; i++) {
1070 v = (v << 7) | (uint64_t)(buf[i] & 0x7f);
1071 if ((buf[i] & 0x80) == 0) {
1072 *out = v;
1073 return i + 1;
1074 }
1075 }
1076 v = (v << 8) | (uint64_t)buf[8];
1077 *out = v;
1078 return 9;
1079}
1080
1081// If an index cell's payload exceeds X, rewrite it to spill the tail to
1082// 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