static int lengthVaruint64(PositionedByteRange src, boolean comp) {
    int a0 = (comp ? DESCENDING : ASCENDING).apply(src.peek()) & 0xff;
    if (a0 <= 240) return 1;
    if (a0 <= 248) return 2;
    if (a0 == 249) return 3;
    if (a0 == 250) return 4;
    if (a0 == 251) return 5;
    if (a0 == 252) return 6;
    if (a0 == 253) return 7;
    if (a0 == 254) return 8;
    if (a0 == 255) return 9;
    throw unexpectedHeader(src.peek());
  }
Inspect {@code src} for an encoded varuint64 for its length in bytes. Preserves the state of
{@code src}.
@param src  source buffer
@param comp if true, parse the compliment of the value.
@return the number of bytes consumed by this value.
hbase-common/src/main/java/org/apache/hadoop/hbase/util/OrderedBytes.java