public long readVolatileLong() { return wrapped.readVolatileLong(); }
public long readVolatileLong(long offset) { return wrapped.readVolatileLong(offset); }
public long readVolatileLong(long offset) { return wrapped.readVolatileLong(offset); }
public long readVolatileLong() { return wrapped.readVolatileLong(); }
@Override public long cardinality() { long count = Long.bitCount(bytes.readVolatileLong(0)); for (long i = 1; i < longLength; i++) { count += Long.bitCount(readLong(i)); } return count; }
public long readVolatileLong(long offset) { this.checkNotClosed(); return this.bytes.readVolatileLong(offset); }
@Override public long getLongVolatile(Bytes bytes, long offset) { long value = bytes.readVolatileLong(offset); if (bytes.byteOrder() != nativeOrder()) value = Long.reverseBytes(value); return value; }
@Override public long cardinality() { long count = Long.bitCount(bytes.readVolatileLong(0)); for (long i = 1; i < longLength; i++) { count += Long.bitCount(readLong(i)); } return count; }
public long readVolatileLong() { this.checkNotClosed(); return this.bytes.readVolatileLong(); }
private long readVolatileLong(long longIndex) { return bytes.readVolatileLong(firstByte(longIndex)); }
@Override public long getLongVolatile(Bytes bytes, long offset) { long value = bytes.readVolatileLong(offset); if (bytes.byteOrder() != nativeOrder()) value = Long.reverseBytes(value); return value; }
public long readVolatileLong() { this.checkNotClosed(); return this.bytes.readVolatileLong(); }
public long readVolatileLong(long offset) { this.checkNotClosed(); return this.bytes.readVolatileLong(offset); }
private long readVolatileLong(long longIndex) { return bytes.readVolatileLong(firstByte(longIndex)); }
@Override public boolean clearIfSet(long bitIndex) { long longIndex = longWithThisBit(bitIndex); if (bitIndex < 0 || longIndex >= longLength) throw new IndexOutOfBoundsException(); long byteIndex = firstByte(longIndex); long mask = singleBit(bitIndex); while (true) { long l = bytes.readVolatileLong(byteIndex); if ((l & mask) == 0) return false; long l2 = l & ~mask; if (bytes.compareAndSwapLong(byteIndex, l, l2)) return true; } }
@Override public DirectBitSet flip(long bitIndex) { long longIndex = longWithThisBit(bitIndex); if (bitIndex < 0 || longIndex >= longLength) throw new IndexOutOfBoundsException(); long byteIndex = firstByte(longIndex); // only 6 lowest-order bits used, JLS 15.19 long mask = singleBit(bitIndex); while (true) { long l = bytes.readVolatileLong(byteIndex); long l2 = l ^ mask; if (bytes.compareAndSwapLong(byteIndex, l, l2)) return this; } }
@Override public DirectBitSet set(long bitIndex) { long longIndex = longWithThisBit(bitIndex); if (bitIndex < 0 || longIndex >= longLength) throw new IndexOutOfBoundsException(); long byteIndex = firstByte(longIndex); long mask = singleBit(bitIndex); while (true) { long l = bytes.readVolatileLong(byteIndex); if ((l & mask) != 0) return this; long l2 = l | mask; if (bytes.compareAndSwapLong(byteIndex, l, l2)) return this; } }
@Override public DirectBitSet flip(long bitIndex) { long longIndex = longWithThisBit(bitIndex); if (bitIndex < 0 || longIndex >= longLength) throw new IndexOutOfBoundsException(); long byteIndex = firstByte(longIndex); // only 6 lowest-order bits used, JLS 15.19 long mask = singleBit(bitIndex); while (true) { long l = bytes.readVolatileLong(byteIndex); long l2 = l ^ mask; if (bytes.compareAndSwapLong(byteIndex, l, l2)) return this; } }
@Override public DirectBitSet set(long bitIndex) { long longIndex = longWithThisBit(bitIndex); if (bitIndex < 0 || longIndex >= longLength) throw new IndexOutOfBoundsException(); long byteIndex = firstByte(longIndex); long mask = singleBit(bitIndex); while (true) { long l = bytes.readVolatileLong(byteIndex); if ((l & mask) != 0) return this; long l2 = l | mask; if (bytes.compareAndSwapLong(byteIndex, l, l2)) return this; } }
@Override public DirectBitSet clear(long bitIndex) { long longIndex = longWithThisBit(bitIndex); if (bitIndex < 0 || longIndex >= longLength) throw new IndexOutOfBoundsException(); long byteIndex = firstByte(longIndex); long mask = singleBit(bitIndex); while (true) { long l = bytes.readVolatileLong(byteIndex); if ((l & mask) == 0) return this; long l2 = l & ~mask; if (bytes.compareAndSwapLong(byteIndex, l, l2)) return this; } }