@Override public long getFirstFreeTierIndex() { return (bs.readLong(offset + 3)) & ((1L << 40) - 1); }
@Override public long getValue2() { return bytes.readLong(offset + 8); }
@Override public long getExtraTiersInUse() { return (bs.readLong(offset + 8)) & ((1L << 40) - 1); }
@Override public long getExtraTiersInUse() { return (bs.readLong(offset + 8)) & ((1L << 40) - 1); }
long fetch64(BytesStore bytes, long off) { return bytes.readLong(off); }
@Override public long getValue() { return bytes == null ? 0L : bytes.readLong(offset); }
@Override public long getDataStoreSize() { return bs.readLong(offset + 17); }
@Override public long getFirstFreeTierIndex() { return (bs.readLong(offset + 3)) & ((1L << 40) - 1); }
@Override public long get(BytesStore bytes, long index) { return bytes.readLong(index << 3); }
public static long peakLength(@NotNull BytesStore bytes, long offset) throws BufferUnderflowException { final long capacity = bytes.readLong(offset + CAPACITY); assert capacity > 0 : "capacity too small " + capacity; return (capacity << 3) + VALUES; }
@Override public long readLong() throws BufferUnderflowException { try { long offset = readOffsetPositionMoved(8); return bytesStore.readLong(offset); } catch (BufferUnderflowException e) { if (lenient) { return 0; } throw e; } }
@Override public long addDataStoreSize(long addition) { long oldDataStoreSize = bs.readLong(offset + 17); long newDataStoreSize = oldDataStoreSize + addition; if (newDataStoreSize < 0) { throw new IllegalStateException("bs.readLong(offset + 17) should be in [0, 9223372036854775807] range, the value was " + oldDataStoreSize + ", + " + addition + " = " + newDataStoreSize + " out of the range"); } bs.writeLong(offset + 17, newDataStoreSize); return newDataStoreSize; }
@Override public long readLong(long offset) throws BufferUnderflowException { readCheckOffset(offset, 8, true); return bytesStore.readLong(offset); }
@Override public void setFirstFreeTierIndex(long _firstFreeTierIndex) { if (_firstFreeTierIndex < 0 || _firstFreeTierIndex > 1099511627775L) { throw new IllegalArgumentException("_firstFreeTierIndex should be in [0, 1099511627775] range, " + _firstFreeTierIndex + " is given"); } bs.writeLong(offset + 3, ((bs.readLong(offset + 3)) & 0xFFFFFF0000000000L) | (_firstFreeTierIndex)); }
@Override public void setExtraTiersInUse(long _extraTiersInUse) { if (_extraTiersInUse < 0 || _extraTiersInUse > 1099511627775L) { throw new IllegalArgumentException("_extraTiersInUse should be in [0, 1099511627775] range, " + _extraTiersInUse + " is given"); } bs.writeLong(offset + 8, ((bs.readLong(offset + 8)) & 0xFFFFFF0000000000L) | (_extraTiersInUse)); }
/** * Check if a portion of a BytesStore matches this one. * * @param bytesStore to match against * @param length to match. * @return true if the bytes up to min(length, this.length(), bytesStore.length()) matched. */ default boolean equalBytes(@NotNull BytesStore bytesStore, long length) throws BufferUnderflowException { return length == 8 && bytesStore.length() >= 8 ? readLong(readPosition()) == bytesStore.readLong(bytesStore.readPosition()) : BytesInternal.equalBytesAny(this, bytesStore, length); }
@Override public void writeMarshallable(BytesOut bytes) { bytes.writeInt((bs.readInt(offset + 0)) & ((1 << 24) - 1)); bytes.writeLong((bs.readLong(offset + 3)) & ((1L << 40) - 1)); bytes.writeLong((bs.readLong(offset + 8)) & ((1L << 40) - 1)); bytes.writeLong((bs.readInt(offset + 13)) & 0xFFFFFFFFL); bytes.writeLong(bs.readLong(offset + 17)); }
@NotNull @Override public Bytes<Void> write(@NotNull BytesStore bytes, long offset, long length) throws BufferUnderflowException, BufferOverflowException { assert singleThreadedAccess(); if (length == 8) writeLong(bytes.readLong(offset)); else if (bytes.isDirectMemory() && length <= Math.min(writeRemaining(), safeCopySize())) rawCopy(bytes, offset, length); else if (length > 0) BytesInternal.writeFully(bytes, offset, length, this); return this; }
@Override public void writeMarshallable(BytesOut bytes) { bytes.writeInt((bs.readInt(offset + 0)) & ((1 << 24) - 1)); bytes.writeLong((bs.readLong(offset + 3)) & ((1L << 40) - 1)); bytes.writeLong((bs.readLong(offset + 8)) & ((1L << 40) - 1)); bytes.writeLong((bs.readInt(offset + 13)) & 0xFFFFFFFFL); bytes.writeLong(bs.readLong(offset + 17)); bytes.writeInt(bs.readInt(offset + 25)); bytes.writeInt((bs.readByte(offset + 29)) & 0xFF); for (int index = 0; index < 128; index++) { bytes.writeBoolean(getModificationIteratorInitAt(index)); } }
@Override public void readMarshallable(BytesIn bytes) { bs.writeInt(offset + 0, ((bs.readInt(offset + 0)) & 0xFF000000) | (bytes.readInt())); bs.writeLong(offset + 3, ((bs.readLong(offset + 3)) & 0xFFFFFF0000000000L) | (bytes.readLong())); bs.writeLong(offset + 8, ((bs.readLong(offset + 8)) & 0xFFFFFF0000000000L) | (bytes.readLong())); bs.writeInt(offset + 13, (int) (bytes.readLong())); bs.writeLong(offset + 17, bytes.readLong()); bs.writeInt(offset + 25, bytes.readInt()); bs.writeByte(offset + 29, (byte) (bytes.readInt())); for (int index = 0; index < 128; index++) { setModificationIteratorInitAt(index, bytes.readBoolean()); } }