Bitwise xor bits.

@param right the right
@return the bits
435989
public Bits bitwiseXor(final Bits right) {
    final int lengthDifference = this.bitLength - right.bitLength;
    if (lengthDifference < 0) {
      return this.concatenate(
        new Bits(0l, -lengthDifference)).bitwiseXor(right);
    }
    if (lengthDifference > 0) {
      return this.bitwiseXor(right
        .concatenate(new Bits(0l, lengthDifference)));
    }
    final Bits returnValue = new Bits(
      new byte[this.bytes.length],
      this.bitLength);
    for (int i = 0; i < this.bytes.length; i++) {
      returnValue.bytes[i] = this.bytes[i];
    }
    for (int i = 0; i < right.bytes.length; i++) {
      returnValue.bytes[i] ^= right.bytes[i];
    }
    return returnValue;
  }
1024944
private static int hi0bits(int x)
    {
        int k = 0;

        if ((x & 0xffff0000) == 0) {
            k = 16;
            x <<= 16;
        }
        if ((x & 0xff000000) == 0) {
            k += 8;
            x <<= 8;
        }
        if ((x & 0xf0000000) == 0) {
            k += 4;
            x <<= 4;
        }
        if ((x & 0xc0000000) == 0) {
            k += 2;
            x <<= 2;
        }
        if ((x & 0x80000000) == 0) {
            k++;
            if ((x & 0x40000000) == 0)
                return 32;
        }
        return k;
    }
658835
public static Boolean xor(Boolean left, Boolean right) {
        return left ^ Boolean.TRUE.equals(right);
    }
997398
public static function doBinaryOperation($left, $operator, $right)
    {
        if (self::$binaryOperations === null) {
            self::$binaryOperations = [
                    self::BITWISE_AND              => function ($l, $r) { return $l & $r; },
                    self::BITWISE_OR               => function ($l, $r) { return $l | $r; },
                    self::BITWISE_XOR              => function ($l, $r) { return $l ^ $r; },
                    self::SHIFT_LEFT               => function ($l, $r) { return $l << $r; },
                    self::SHIFT_RIGHT              => function ($l, $r) { return $l >> $r; },
                    self::LOGICAL_AND              => function ($l, $r) { return $l && $r; },
                    self::LOGICAL_OR               => function ($l, $r) { return $l || $r; },
                    self::ADDITION                 => function ($l, $r) { return $l + $r; },
                    self::SUBTRACTION              => function ($l, $r) { return $l - $r; },
                    self::MULTIPLICATION           => function ($l, $r) { return $l * $r; },
                    self::DIVISION                 => function ($l, $r) { return $l / $r; },
                    self::MODULUS                  => function ($l, $r) { return $l % $r; },
                    //Compatible with < PHP 5.6
                    self::POWER                    => function ($l, $r) { return pow($l, $r); },
                    self::CONCATENATION            => function ($l, $r) { return $l . $r; },
                    self::IS_INSTANCE_OF           => function ($l, $r) { return $l instanceof $r; },
                    self::EQUALITY                 => function ($l, $r) { return $l == $r; },
                    self::IDENTITY                 => function ($l, $r) { return $l === $r; },
                    self::INEQUALITY               => function ($l, $r) { return $l != $r; },
                    self::NOT_IDENTICAL            => function ($l, $r) { return $l !== $r; },
                    self::LESS_THAN                => function ($l, $r) { return $l < $r; },
                    self::LESS_THAN_OR_EQUAL_TO    => function ($l, $r) { return $l <= $r; },
                    self::GREATER_THAN             => function ($l, $r) { return $l > $r; },
                    self::GREATER_THAN_OR_EQUAL_TO => function ($l, $r) { return $l >= $r; },
            ];
        }

        if (!isset(self::$binaryOperations[$operator])) {
            throw new PinqException('Binary operator \'%s\' is not supported', $operator);
        }

        $operation = self::$binaryOperations[$operator];

        return $operation($left, $right);
    }
1048584
public static Slice rightTrim(Slice utf8)
    {
        int position = lastNonWhitespacePosition(utf8, 0);
        return utf8.slice(0, position);
    }
82676
private static byte[] toByteArrayReverse(BitSet bits) {
        byte[] bytes = new byte[bits.length() / 8 + 1];
        for (int i = 0; i < bits.length(); i++) {
            if (bits.get(i)) {
                final int value = bytes[i / 8] | (1 << (7 - (i % 8)));
                bytes[i / 8] = (byte) value;
            }
        }
        return bytes;
    }
721285
public static long reverseBits(final long value) {
    final long b0 = JBBPUtils.reverseBitsInByte((byte) value) & 0xFFL;
    final long b1 = JBBPUtils.reverseBitsInByte((byte) (value >> 8)) & 0xFFL;
    final long b2 = JBBPUtils.reverseBitsInByte((byte) (value >> 16)) & 0xFFL;
    final long b3 = JBBPUtils.reverseBitsInByte((byte) (value >> 24)) & 0xFFL;
    final long b4 = JBBPUtils.reverseBitsInByte((byte) (value >> 32)) & 0xFFL;
    final long b5 = JBBPUtils.reverseBitsInByte((byte) (value >> 40)) & 0xFFL;
    final long b6 = JBBPUtils.reverseBitsInByte((byte) (value >> 48)) & 0xFFL;
    final long b7 = JBBPUtils.reverseBitsInByte((byte) (value >> 56)) & 0xFFL;

    return (b0 << 56) | (b1 << 48) | (b2 << 40) | (b3 << 32) | (b4 << 24) | (b5 << 16) | (b6 << 8) | b7;
  }
1166260
function bits( x ) {
	var b;

	// Convert the input value to a bit string:
	b = div2( x );

	// Left pad the bit string to ensure 8 bits are represented:
	b = lpad( b, NBITS, '0' );

	return b;
}
712698
public static boolean[] getBits(final byte b) {
        final boolean[] res = new boolean[8];
        for (int i = 0; i < 8; i++) {
            res[7 - i] = (b & (1 << i)) != 0;
        }
        return res;
    }
64372
public int[] getTopLeftOnBit() {
    int bitsOffset = 0;
    while (bitsOffset < bits.length && bits[bitsOffset] == 0) {
      bitsOffset++;
    }
    if (bitsOffset == bits.length) {
      return null;
    }
    int y = bitsOffset / rowSize;
    int x = (bitsOffset % rowSize) * 32;

    int theBits = bits[bitsOffset];
    int bit = 0;
    while ((theBits << (31 - bit)) == 0) {
      bit++;
    }
    x += bit;
    return new int[] {x, y};
  }
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;
    }
1174782
public static long reverseBits(final byte value, final JBBPBitNumber bits) {
    return JBBPUtils.reverseBitsInByte(value) >>> (8 - bits.getBitNumber()) & bits.getMask();
  }
338063
public static final long fromBitSet(final BitSet bits) {
    long value = 0L;
    for (int i = 0; i < bits.size(); i++) {
      value += bits.get(i) ? (1L << i) : 0L;
    }
    return value;
  }
973640
static final int get6Bit(final Memory mem, final int offsetBytes, final int slotNo) {
    final int startBit = slotNo * 6;
    final int shift = startBit & 0X7;
    final int byteIdx = (startBit >>> 3) + offsetBytes;
    return (byte) ((mem.getShort(byteIdx) >>> shift) & 0X3F);
  }
883124
public int hgetbits(int N)
   {
   	 totbit += N;
	 
	 int val = 0;
	 
	 int pos = buf_byte_idx;
	 if (pos+N < BUFSIZE)
	 {
		while (N-- > 0)
		{
			val <<= 1;
			val |= ((buf[pos++]!=0) ? 1 : 0);		 
		}
	}
	 else
	 {	 
		 while (N-- > 0)
		{
			 val <<= 1;			 
			 val |= ((buf[pos]!=0) ? 1 : 0);
			 pos = (pos+1) & BUFSIZE_MASK;
		}		 
	 }	
	 buf_byte_idx = pos;
	 return val;
   }
1029337
void xor(LongBitSet other) {
		assert other.numWords <= numWords : "numWords=" + numWords + ", other.numWords=" + other.numWords;
		int pos = Math.min(numWords, other.numWords);
		while (--pos >= 0) {
			bits[pos] ^= other.bits[pos];
		}
	}
1096267
function bitwise(str){
	var hash = 0;
	if (str.length == 0) return hash;
	for (var i = 0; i < str.length; i++) {
		var ch = str.charCodeAt(i);
		hash = ((hash<<5)-hash) + ch;
		hash = hash & hash; // Convert to 32bit integer
	}
	return hash;
}