boolean trySetLock(long lock0, long lock2) { return bytes.compareAndSwapLong(offset, lock0, lock2); }
public boolean compareAndSwapLong(long offset, long expected, long x) { return wrapped.compareAndSwapLong(offset, expected, x); }
public boolean compareAndSwapLong(long offset, long expected, long x) { return wrapped.compareAndSwapLong(offset, expected, x); }
@Override public boolean compareAndSwapLong(Bytes bytes, long offset, long expected, long x) { if (bytes.byteOrder() != nativeOrder()) { expected = Long.reverseBytes(expected); x = Long.reverseBytes(x); } return bytes.compareAndSwapLong(offset, expected, x); }
@Override public boolean compareAndSwapLong(Bytes bytes, long offset, long expected, long x) { if (bytes.byteOrder() != nativeOrder()) { expected = Long.reverseBytes(expected); x = Long.reverseBytes(x); } return bytes.compareAndSwapLong(offset, expected, x); }
public boolean compareAndSwapLong(long offset, long expected, long x) { this.checkNotClosed(); return this.bytes.compareAndSwapLong(offset, expected, x); }
public boolean compareAndSwapLong(long offset, long expected, long x) { this.checkNotClosed(); return this.bytes.compareAndSwapLong(offset, expected, x); }
@Override public DirectBitSet or(long longIndex, long value) { while (true) { long l = readVolatileLong(longIndex); long l2 = l | value; if (l == l2 || bytes.compareAndSwapLong(firstByte(longIndex), l, l2)) return this; } }
@Override public DirectBitSet xor(long longIndex, long value) { while (true) { long l = readVolatileLong(longIndex); long l2 = l ^ value; if (bytes.compareAndSwapLong(firstByte(longIndex), l, l2)) return this; } }
@Override public DirectBitSet or(long longIndex, long value) { while (true) { long l = readVolatileLong(longIndex); long l2 = l | value; if (l == l2 || bytes.compareAndSwapLong(firstByte(longIndex), l, l2)) return this; } }
@Override public DirectBitSet and(long longIndex, long value) { while (true) { long l = readVolatileLong(longIndex); long l2 = l & value; if (l == l2 || bytes.compareAndSwapLong(firstByte(longIndex), l, l2)) return this; } }
@Override public DirectBitSet and(long longIndex, long value) { while (true) { long l = readVolatileLong(longIndex); long l2 = l & value; if (l == l2 || bytes.compareAndSwapLong(firstByte(longIndex), l, l2)) return this; } }
@Override public DirectBitSet andNot(long longIndex, long value) { while (true) { long l = readVolatileLong(longIndex); long l2 = l & ~value; if (bytes.compareAndSwapLong(firstByte(longIndex), l, l2)) return this; } }
@Override public DirectBitSet andNot(long longIndex, long value) { while (true) { long l = readVolatileLong(longIndex); long l2 = l & ~value; if (bytes.compareAndSwapLong(firstByte(longIndex), l, l2)) return this; } }
@Override public DirectBitSet xor(long longIndex, long value) { while (true) { long l = readVolatileLong(longIndex); long l2 = l ^ value; if (bytes.compareAndSwapLong(firstByte(longIndex), 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; } }
@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 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; } }
@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; } }