private static ByteSlice compressNumber(ByteSlice data, int itemSize, int byteSizeShift, long maxVal, NumberCompressor compressor) {
        assert data.size() == (itemSize << byteSizeShift);
        if (itemSize == 0 || maxVal == 0) {
            return ByteSlice.empty();
        }
        long native_p = compressor.compress(data.address(), itemSize, maxVal);
        int err = MemoryUtil.getByte(native_p);
        if (err != BhcompressLibrary.CprsErr_J.CPRS_SUCCESS_J) {
            MemoryUtil.free(native_p);
            throw new RuntimeException(String.format("compress number err[%d]", err));
        }
        int cmp_data_size = MemoryUtil.getInt(native_p + 9);
        return ByteSlice.fromAddress(native_p, 1 + 8 + 4 + cmp_data_size, true);
    }
Wrapper of brighthouse compression.
This class is closely linked to cpp code and native data structure, don't touch it unless you know what you are doing.

Note that all values here are in unsigned form, including max_val.
indexr-segment/src/main/java/io/indexr/compress/bh/BHCompressor.java