Return the encoded length of the listpack element pointed by 'p'. * This includes the encoding byte, length bytes, and the element data itself. * If the element encoding is wrong then 0 is returned. * Note that this method may access additional bytes (in case of 12 and 32 bit * str), so should only be called when we know 'p' was already validated by * lpCurrentEncodedSizeBytes or ASSERT_INTEG
| 407 | * lpCurrentEncodedSizeBytes or ASSERT_INTEGRITY_LEN (possibly since 'p' is |
| 408 | * a return value of another function that validated its return. */ |
| 409 | uint32_t lpCurrentEncodedSizeUnsafe(unsigned char *p) { |
| 410 | if (LP_ENCODING_IS_7BIT_UINT(p[0])) return 1; |
| 411 | if (LP_ENCODING_IS_6BIT_STR(p[0])) return 1+LP_ENCODING_6BIT_STR_LEN(p); |
| 412 | if (LP_ENCODING_IS_13BIT_INT(p[0])) return 2; |
| 413 | if (LP_ENCODING_IS_16BIT_INT(p[0])) return 3; |
| 414 | if (LP_ENCODING_IS_24BIT_INT(p[0])) return 4; |
| 415 | if (LP_ENCODING_IS_32BIT_INT(p[0])) return 5; |
| 416 | if (LP_ENCODING_IS_64BIT_INT(p[0])) return 9; |
| 417 | if (LP_ENCODING_IS_12BIT_STR(p[0])) return 2+LP_ENCODING_12BIT_STR_LEN(p); |
| 418 | if (LP_ENCODING_IS_32BIT_STR(p[0])) return 5+LP_ENCODING_32BIT_STR_LEN(p); |
| 419 | if (p[0] == LP_EOF) return 1; |
| 420 | return 0; |
| 421 | } |
| 422 | |
| 423 | /* Return bytes needed to encode the length of the listpack element pointed by 'p'. |
| 424 | * This includes just the encodign byte, and the bytes needed to encode the length |
no outgoing calls
no test coverage detected