presto-rcfile/src/main/java/io/prestosql/rcfile/binary/DecimalEncoding.java/DecimalEncoding/getWriteByteCount
class DecimalEncoding:    private static int getWriteByteCount(long value)
    {
        // if the value is negative flip the bits, so we can always count leading zero bytes
        if (value < 0) {
            value = ~value;
        }

        // count number of leading zero bytes
        return (Long.SIZE - Long.numberOfLeadingZeros(value)) / BITS_IN_BYTE + 1;
    }