MCPcopy Create free account
hub / github.com/4paradigm/OpenMLDB / CalcUnpackVariableFormat

Function CalcUnpackVariableFormat

src/codec/memcomparable_format.h:324–339  ·  view source on GitHub ↗

Calculate the number of used bytes in the chunk and whether this is the last chunk in the input. This is based on the new format - see pack_variable_format. */

Source from the content-addressed store, hash-verified

322 pack_variable_format.
323*/
324__attribute__((unused)) static uint32_t CalcUnpackVariableFormat(uchar flag,
325 bool *done) {
326 // Check for invalid flag values
327 if (flag > RDB_ESCAPE_LENGTH) {
328 return (uint32_t)-1;
329 }
330 // Values from 1 to N-1 indicate this is the last chunk and that is how
331 // many bytes were used
332 if (flag < RDB_ESCAPE_LENGTH) {
333 *done = true;
334 return flag;
335 }
336 // A value of N means we used N-1 bytes and had more to go
337 *done = false;
338 return RDB_ESCAPE_LENGTH - 1;
339}
340
341/*
342 Function of type rdb_index_field_unpack_t

Callers 1

UnpackStringFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected