/** * Helper function to compare a set of bytes in ArrowBuf to a ByteArray. * * @param left Left ArrowBuf for comparison purposes * @param lStart start offset in the buffer * @param lEnd end offset in the buffer * @param right second input to be compared * @param rStart start offset in the byte array * @param rEnd end offset in the byte array * @return 1 if left input is greater, -1 if left input is smaller, 0 otherwise */ public static final int compare( final ArrowBuf left, int lStart, int lEnd, final byte[] right, int rStart, final int rEnd) { if (BoundsChecking.BOUNDS_CHECKING_ENABLED) { left.checkBytes(lStart, lEnd); } return memcmp(left.memoryAddress(), lStart, lEnd, right, rStart, rEnd); }
/** * Helper function to compare a set of bytes in two ArrowBufs. * * <p>Function will check data before completing in the case that * * @param left Left ArrowBuf to compare * @param lStart start offset in the buffer * @param lEnd end offset in the buffer * @param right Right ArrowBuf to compare * @param rStart start offset in the buffer * @param rEnd end offset in the buffer * @return 1 if left input is greater, -1 if left input is smaller, 0 otherwise */ public static final int compare( final ArrowBuf left, int lStart, int lEnd, final ArrowBuf right, int rStart, int rEnd) { if (BoundsChecking.BOUNDS_CHECKING_ENABLED) { left.checkBytes(lStart, lEnd); right.checkBytes(rStart, rEnd); } return memcmp(left.memoryAddress(), lStart, lEnd, right.memoryAddress(), rStart, rEnd); }