MCPcopy Create free account
hub / github.com/F-Stack/f-stack / lpDecodeBacklen

Function lpDecodeBacklen

app/redis-6.2.6/src/listpack.c:367–378  ·  view source on GitHub ↗

Decode the backlen and returns it. If the encoding looks invalid (more than * 5 bytes are used), UINT64_MAX is returned to report the problem. */

Source from the content-addressed store, hash-verified

365/* Decode the backlen and returns it. If the encoding looks invalid (more than
366 * 5 bytes are used), UINT64_MAX is returned to report the problem. */
367uint64_t lpDecodeBacklen(unsigned char *p) {
368 uint64_t val = 0;
369 uint64_t shift = 0;
370 do {
371 val |= (uint64_t)(p[0] & 127) << shift;
372 if (!(p[0] & 128)) break;
373 shift += 7;
374 p--;
375 if (shift > 28) return UINT64_MAX;
376 } while(1);
377 return val;
378}
379
380/* Encode the string element pointed by 's' of size 'len' in the target
381 * buffer 's'. The function should be called with 'buf' having always enough

Callers 2

lpPrevFunction · 0.85
lpValidateNextFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected