Compare two bitsets.

@param x First bitset
@param y Second bitset
@return Comparison result
515100
public static int compare(long[] x, long[] y) {
    if(x == null) {
      return (y == null) ? 0 : -1;
    }
    if(y == null) {
      return +1;
    }
    int p = Math.min(x.length, y.length) - 1;
    for(int i = x.length - 1; i > p; i--) {
      if(x[i] != 0) {
        return +1;
      }
    }
    for(int i = y.length - 1; i > p; i--) {
      if(y[i] != 0) {
        return -1;
      }
    }
    for(; p >= 0; p--) {
      final long xp = x[p], yp = y[p];
      if(xp != yp) {
        return xp < 0 ? (yp < 0 && yp < xp) ? -1 : +1 : (yp < 0 || xp < yp) ? -1 : +1;
      }
    }
    return 0;
  }
538005
public static int compareBytes(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) {
        return WritableComparator.compareBytes(b1, s1, l1, b2, s2, l2);
    }
1319437
public static float compare(final int numOfBits, final byte[] data1,
            final byte[] data2) {
        if (data1.length != data2.length) {
            return 0;
        }
        final int count = countSameBits(data1, data2);
        return (float) count / (float) numOfBits;
    }
208520
@Pure
	protected int compareSegments(ST s1, ST s2) {
		assert s1 != null && s2 != null;
		return s1.hashCode() - s2.hashCode();
	}
550617
private int findFirstDifferingBit(String key1, String key2) {
        int bit = 0;

        while (keyMapper.isSet(bit, key1) == keyMapper.isSet(bit, key2)) {
            bit++;
        }
        return bit;
    }
925401
@SuppressWarnings("ObjectEquality")
    public int compareTo(int offset, int length, Slice that, int otherOffset, int otherLength)
    {
        return compareTo(offset, length, that.base, otherOffset, otherLength);
    }
679758
void difference(IntSet dest, IntSet compared) {
        int i = 0;
        int j = 0;
        while (i < size && j < compared.size) {
            int a = elements[i];
            int b = compared.elements[j];
            if (a < b) {
                // our set has a value that is not in "compared"
                dest.addInt(a);
                i ++;
            } else if (a > b) {
                // "compared" has a value that is not in our set.
                j ++;
            } else {
                // the sets match at this index.
                i ++;
                j ++;
            }
        }
        // anything left in our set is part of the delta and belongs in "dest".
        while (i < size) {
            dest.addInt(elements[i]);
            i ++;
        }
    }
988399
public static int binaryLCA(int x, int y) {
		if (x == y) {
			return x;
		}
		int xor = x ^ y;
		int idx = getMaxExp(xor);
		if (idx == -1) {
			throw new UnsupportedOperationException();
		}
		return replaceBy1and0sFrom(x, idx);
	}
1352829
private HashSet<Integer> vector2set(int y[]) {
        HashSet<Integer> Y = new HashSet<Integer>();
        for (int j = 0; j < y.length; j++) {
            if (y[j] > 0) {
                Y.add(j);
            }
        }
        return Y;
    }
1346428
public static int d(int x, int y) {
        int dist = 0;
        int val = x ^ y;

        // Count the number of set bits (Knuth's algorithm)
        while (val != 0) {
            ++dist;
            val &= val - 1;
        }

        return dist;
    }
589216
public static int unionSize(long[] x, long[] y) {
    final int lx = x.length, ly = y.length;
    final int min = (lx < ly) ? lx : ly;
    int i = 0, res = 0;
    for(; i < min; i++) {
      res += Long.bitCount(x[i] | y[i]);
    }
    for(; i < lx; i++) {
      res += Long.bitCount(x[i]);
    }
    for(; i < ly; i++) {
      res += Long.bitCount(y[i]);
    }
    return res;
  }
701820
public BitSet projectG1(BitSet set) {
        BitSet projection = new BitSet(firstGraphSize);
        RNode xNode = null;

        for (int x = set.nextSetBit(0); x >= 0; x = set.nextSetBit(x + 1)) {
            xNode = (RNode) graph.get(x);
            projection.set(xNode.rMap.id1);
        }
        return projection;
    }
245155
private boolean isContainedIn(BitSet A, BitSet B) {
        boolean result = false;

        if (A.isEmpty()) {
            return true;
        }

        BitSet setA = (BitSet) A.clone();
        setA.and(B);

        if (setA.equals(A)) {
            result = true;
        }

        return result;
    }
774865
@Pure
	@Inline(value="($1 & $2)", constantExpression=true)
	public static int bitwiseAnd(int a, int b) {
		return a & b;
	}
779876
public SDVariable atan2(SDVariable y, SDVariable x) {
        return atan2(null, y, x);
    }
278672
public Bits diffSet(Bits xs) {
        Assert.check(currentState != BitsState.UNKNOWN);
        for (int i = 0; i < bits.length; i++) {
            if (i < xs.bits.length) {
                bits[i] = bits[i] & ~xs.bits[i];
            }
        }
        currentState = BitsState.NORMAL;
        return this;
    }
268362
public boolean isSeparatorAt(int x, int y)
    {
        return containsSeparatorAt(x, y, bsep) ||
               containsSeparatorAt(x, y, hsep) ||
               containsSeparatorAt(x, y, vsep);
    }