public static int sizeOfUnsignedVarlong(long v) {
        // For implementation notes @see #sizeOfUnsignedVarint(int)
        // Similar logic is applied to allow for 64bit input -> 1-9byte output.
        // return (70 - leadingZeros) / 7 + leadingZeros / 64;

        int leadingZeros = Long.numberOfLeadingZeros(v);
        int leadingZerosBelow70DividedBy7 = ((70 - leadingZeros) * 0b10010010010010011) >>> 19;
        return leadingZerosBelow70DividedBy7 + (leadingZeros >>> 6);
    }
Number of bytes needed to encode a long in variable-length format.

@param value The signed value
@see #sizeOfUnsignedVarint(int)
clients/src/main/java/org/apache/kafka/common/utils/ByteUtils.java