/** * Compare two heap objects. * * @param o1 Object 1. * @param o2 Object 2. * @return Result. */ private static boolean equalsHeap(BinaryObjectExImpl o1, BinaryObjectExImpl o2) { byte[] arr1 = o1.array(); byte[] arr2 = o2.array(); assert arr1 != null && arr2 != null; int i = o1.dataStartOffset(); int j = o2.dataStartOffset(); int end = o1.footerStartOffset(); // Check length. if (end - i != o2.footerStartOffset() - j) return false; for (; i < end; i++, j++) { if (arr1[i] != arr2[j]) return false; } return true; }
/** * Compare heap and offheap objects. * * @param o1 Object 1 (heap). * @param o2 Object 2 (offheap). * @return Result. */ private static boolean equalsHeapOffheap(BinaryObjectExImpl o1, BinaryObjectExImpl o2) { byte[] arr1 = o1.array(); long ptr2 = o2.offheapAddress(); assert arr1 != null && ptr2 != 0; int i = o1.dataStartOffset(); int j = o2.dataStartOffset(); int end = o1.footerStartOffset(); // Check length. if (end - i != o2.footerStartOffset() - j) return false; for (; i < end; i++, j++) { if (arr1[i] != BinaryPrimitives.readByte(ptr2, j)) return false; } return true; }
/** * Compare two offheap objects. * * @param o1 Object 1. * @param o2 Object 2. * @return Result. */ private static boolean equalsOffheap(BinaryObjectExImpl o1, BinaryObjectExImpl o2) { long ptr1 = o1.offheapAddress(); long ptr2 = o2.offheapAddress(); assert ptr1 != 0 && ptr2 != 0; int i = o1.dataStartOffset(); int j = o2.dataStartOffset(); int end = o1.footerStartOffset(); // Check length. if (end - i != o2.footerStartOffset() - j) return false; for (; i < end; i++, j++) { if (BinaryPrimitives.readByte(ptr1, i) != BinaryPrimitives.readByte(ptr2, j)) return false; } return true; }
BinaryObjectExImpl ex = (BinaryObjectExImpl)obj; int start = ex.dataStartOffset(); int end = ex.footerStartOffset();
/** * Compare two heap objects. * * @param o1 Object 1. * @param o2 Object 2. * @return Result. */ private static boolean equalsHeap(BinaryObjectExImpl o1, BinaryObjectExImpl o2) { byte[] arr1 = o1.array(); byte[] arr2 = o2.array(); assert arr1 != null && arr2 != null; int i = o1.dataStartOffset(); int j = o2.dataStartOffset(); int end = o1.footerStartOffset(); // Check length. if (end - i != o2.footerStartOffset() - j) return false; for (; i < end; i++, j++) { if (arr1[i] != arr2[j]) return false; } return true; }
/** * Compare heap and offheap objects. * * @param o1 Object 1 (heap). * @param o2 Object 2 (offheap). * @return Result. */ private static boolean equalsHeapOffheap(BinaryObjectExImpl o1, BinaryObjectExImpl o2) { byte[] arr1 = o1.array(); long ptr2 = o2.offheapAddress(); assert arr1 != null && ptr2 != 0; int i = o1.dataStartOffset(); int j = o2.dataStartOffset(); int end = o1.footerStartOffset(); // Check length. if (end - i != o2.footerStartOffset() - j) return false; for (; i < end; i++, j++) { if (arr1[i] != BinaryPrimitives.readByte(ptr2, j)) return false; } return true; }
/** * Compare two offheap objects. * * @param o1 Object 1. * @param o2 Object 2. * @return Result. */ private static boolean equalsOffheap(BinaryObjectExImpl o1, BinaryObjectExImpl o2) { long ptr1 = o1.offheapAddress(); long ptr2 = o2.offheapAddress(); assert ptr1 != 0 && ptr2 != 0; int i = o1.dataStartOffset(); int j = o2.dataStartOffset(); int end = o1.footerStartOffset(); // Check length. if (end - i != o2.footerStartOffset() - j) return false; for (; i < end; i++, j++) { if (BinaryPrimitives.readByte(ptr1, i) != BinaryPrimitives.readByte(ptr2, j)) return false; } return true; }
BinaryObjectExImpl ex = (BinaryObjectExImpl)obj; int start = ex.dataStartOffset(); int end = ex.footerStartOffset();