/** * Logically XORs this bit set with the specified set of bits. * * @param set the bit set to be XORed with * @throws IllegalArgumentException if set is null */ @Override public final void xor(BitVector set) { if (set == null) { throw new IllegalArgumentException("set is null"); } ensureCapacity(set); int n = Math.min(bits.length, set.bits.length); for (int i = n - 1; i >= 0;) { bits[i] ^= set.bits[i]; i--; } }
/** * Logically XORs this bit set with the specified set of bits. * * @param set the bit set to be XORed with * @throws IllegalArgumentException if set is null */ @Override public final void xor(BitVector set) { if (set == null) { throw new IllegalArgumentException("set is null"); } ensureCapacity(set); int n = Math.min(bits.length, set.bits.length); for (int i = n - 1; i >= 0;) { bits[i] ^= set.bits[i]; i--; } }
/** * Logically XORs this bit set with the specified set of bits. * * @param set the bit set to be XORed with * @throws IllegalArgumentException if set is null */ @Override public final void xor(BitVector set) { if (set == null) { throw new IllegalArgumentException("set is null"); } ensureCapacity(set); int n = Math.min(bits.length, set.bits.length); for (int i = n - 1; i >= 0;) { bits[i] ^= set.bits[i]; i--; } }
/** * Logically ORs this bit set with the specified set of bits. * * @param set the bit set to be ORed with */ @Override public final void or(BitVector set) { if (set == null) { throw new IllegalArgumentException("null set"); } if (this == set) { // should help alias analysis return; } ensureCapacity(set); int n = Math.min(bits.length, set.bits.length); for (int i = n - 1; i >= 0;) { bits[i] |= set.bits[i]; i--; } }
/** * Logically ORs this bit set with the specified set of bits. * * @param set the bit set to be ORed with */ @Override public final void or(BitVector set) { if (set == null) { throw new IllegalArgumentException("null set"); } if (this == set) { // should help alias analysis return; } ensureCapacity(set); int n = Math.min(bits.length, set.bits.length); for (int i = n - 1; i >= 0;) { bits[i] |= set.bits[i]; i--; } }
/** * Logically ORs this bit set with the specified set of bits. * * @param set the bit set to be ORed with */ @Override public final void or(BitVector set) { if (set == null) { throw new IllegalArgumentException("null set"); } if (this == set) { // should help alias analysis return; } ensureCapacity(set); int n = Math.min(bits.length, set.bits.length); for (int i = n - 1; i >= 0;) { bits[i] |= set.bits[i]; i--; } }
/** * Logically ORs this bit set with the specified set of bits. This is performance-critical, and so, a little ugly in an attempt to * help out the compiler. * * @return the number of bits added to this. * @throws IllegalArgumentException if set is null */ public final int orWithDelta(BitVector set) { if (set == null) { throw new IllegalArgumentException("set is null"); } int delta = 0; ensureCapacity(set); int[] otherBits = set.bits; int n = Math.min(bits.length, otherBits.length); for (int i = n - 1; i >= 0;) { int v1 = bits[i]; int v2 = otherBits[i]; if (v1 != v2) { delta -= Bits.populationCount(v1); int v3 = v1 | v2; delta += Bits.populationCount(v3); bits[i] = v3; } i--; } return delta; }
/** * Logically ORs this bit set with the specified set of bits. This is performance-critical, and so, a little ugly in an attempt to * help out the compiler. * * @return the number of bits added to this. * @throws IllegalArgumentException if set is null */ public final int orWithDelta(BitVector set) { if (set == null) { throw new IllegalArgumentException("set is null"); } int delta = 0; ensureCapacity(set); int[] otherBits = set.bits; int n = Math.min(bits.length, otherBits.length); for (int i = n - 1; i >= 0;) { int v1 = bits[i]; int v2 = otherBits[i]; if (v1 != v2) { delta -= Bits.populationCount(v1); int v3 = v1 | v2; delta += Bits.populationCount(v3); bits[i] = v3; } i--; } return delta; }
/** * Logically ORs this bit set with the specified set of bits. This is performance-critical, and so, a little ugly in an attempt to * help out the compiler. * * @return the number of bits added to this. * @throws IllegalArgumentException if set is null */ public final int orWithDelta(BitVector set) { if (set == null) { throw new IllegalArgumentException("set is null"); } int delta = 0; ensureCapacity(set); int[] otherBits = set.bits; int n = Math.min(bits.length, otherBits.length); for (int i = n - 1; i >= 0;) { int v1 = bits[i]; int v2 = otherBits[i]; if (v1 != v2) { delta -= Bits.populationCount(v1); int v3 = v1 | v2; delta += Bits.populationCount(v3); bits[i] = v3; } i--; } return delta; }