Return bytes needed to encode the length of the listpack element pointed by 'p'. * This includes just the encodign byte, and the bytes needed to encode the length * of the element (excluding the element data itself) * If the element encoding is wrong then 0 is returned. */
| 425 | * of the element (excluding the element data itself) |
| 426 | * If the element encoding is wrong then 0 is returned. */ |
| 427 | uint32_t lpCurrentEncodedSizeBytes(unsigned char *p) { |
| 428 | if (LP_ENCODING_IS_7BIT_UINT(p[0])) return 1; |
| 429 | if (LP_ENCODING_IS_6BIT_STR(p[0])) return 1; |
| 430 | if (LP_ENCODING_IS_13BIT_INT(p[0])) return 1; |
| 431 | if (LP_ENCODING_IS_16BIT_INT(p[0])) return 1; |
| 432 | if (LP_ENCODING_IS_24BIT_INT(p[0])) return 1; |
| 433 | if (LP_ENCODING_IS_32BIT_INT(p[0])) return 1; |
| 434 | if (LP_ENCODING_IS_64BIT_INT(p[0])) return 1; |
| 435 | if (LP_ENCODING_IS_12BIT_STR(p[0])) return 2; |
| 436 | if (LP_ENCODING_IS_32BIT_STR(p[0])) return 5; |
| 437 | if (p[0] == LP_EOF) return 1; |
| 438 | return 0; |
| 439 | } |
| 440 | |
| 441 | /* Skip the current entry returning the next. It is invalid to call this |
| 442 | * function if the current element is the EOF element at the end of the |