public static long crc64(final ByteBuffer buf) {
        final int pos = buf.position();
        final int rem = buf.remaining();
        if (rem <= 0) {
            return 0;
        }
        // Currently we have not used DirectByteBuffer yet.
        if (buf.hasArray()) {
            return crc64(buf.array(), pos + buf.arrayOffset(), rem);
        }
        final byte[] b = new byte[rem];
        BufferUtils.mark(buf);
        buf.get(b);
        BufferUtils.reset(buf);
        return crc64(b);
    }
Compute CRC64 checksum for {@code ByteBuffer}.

@param buf source {@code ByteBuffer}
@return checksum value
jraft-core/src/main/java/com/alipay/sofa/jraft/util/CrcUtil.java