@Override public boolean equalBytes(BytesStore bytesStore, long length) throws BufferUnderflowException, IORuntimeException { if (this.bytesStore instanceof NativeBytesStore && bytesStore instanceof VanillaBytes && bytesStore.bytesStore() instanceof NativeBytesStore) { VanillaBytes b2 = (VanillaBytes) bytesStore; NativeBytesStore nbs0 = (NativeBytesStore) this.bytesStore; NativeBytesStore nbs2 = (NativeBytesStore) b2.bytesStore(); long i = 0; for (; i < length - 7; i++) { long addr0 = nbs0.address + readPosition() - nbs0.start() + i; long addr2 = nbs2.address + b2.readPosition() - nbs2.start() + i; long l0 = nbs0.memory.readLong(addr0); long l2 = nbs2.memory.readLong(addr2); if (l0 != l2) return false; } for (; i < length; i++) { long offset2 = readPosition() + i - nbs0.start(); long offset21 = b2.readPosition() + i - nbs2.start(); byte b0 = nbs0.memory.readByte(nbs0.address + offset2); byte b1 = nbs2.memory.readByte(nbs2.address + offset21); if (b0 != b1) return false; } return true; } else { return super.equalBytes(bytesStore, length); } }
@Override public void bytesStore( @NotNull BytesStore<Bytes<Underlying>, Underlying> byteStore, long offset, long length) throws IllegalStateException, BufferOverflowException, BufferUnderflowException { bytesStore(byteStore); // assume its read-only readLimit(offset + length); writeLimit(offset + length); readPosition(offset); }