static int findCommonPrefixUnsafe(Object left, long leftOffset, int leftLength, Object right,
                                      long rightOffset, int rightLength) {
        final int stride = 8;
        final int minLength = Math.min(leftLength, rightLength);
        int strideLimit = minLength & ~(stride - 1);
        int result = 0;
        int i;

        for (i = 0; i < strideLimit; i += stride) {
            long lw = HBasePlatformDependent.getLong(left, leftOffset + (long) i);
            long rw = HBasePlatformDependent.getLong(right, rightOffset + (long) i);

            if (lw != rw) {
                if (!UnsafeAccess.LITTLE_ENDIAN) {
                    return result + (Long.numberOfLeadingZeros(lw ^ rw) / Bytes.SIZEOF_LONG);
                } else {
                    return result + (Long.numberOfTrailingZeros(lw ^ rw) / Bytes.SIZEOF_LONG);
                }
            } else {
                result += Bytes.SIZEOF_LONG;
            }
        }

        // The epilogue to cover the last (minLength % stride) elements.
        for (; i < minLength; i++) {
            byte il = HBasePlatformDependent.getByte(left, leftOffset + i);
            byte ir = HBasePlatformDependent.getByte(right, rightOffset + i);
            if (il != ir) {
                return result;
            } else {
                result++;
            }
        }

        return result;
    }
ByteBuffer to hash offset to start from length to hash
stroom-bytebuffer/src/main/java/stroom/bytebuffer/hbase/ByteBufferUtils.java