Read a SQLite varint (1-9 bytes). Returns bytes consumed.
| 1108 | |
| 1109 | // Read a SQLite varint (1-9 bytes). Returns bytes consumed. |
| 1110 | static 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). |
no outgoing calls
no test coverage detected