Bitwise <br/>
<code>this = this | that</code>
547160
public void add(PagedBitMap that) {
        LongArray ta = that.array;
        long n = 0;
        while(true) {
            n = ta.seekNext(n);
            if (n < 0) {
                break;
            }
            long v = array.get(n) | ta.get(n);
            array.set(n, v);
            ++n;
        }
    }
550617
private int findFirstDifferingBit(String key1, String key2) {
        int bit = 0;

        while (keyMapper.isSet(bit, key1) == keyMapper.isSet(bit, key2)) {
            bit++;
        }
        return bit;
    }
34447
public void xor(BitSet other)
    {
        int newLen = Math.max(wlen, other.wlen);
        ensureCapacityWords(newLen);

        long [] thisArr = this.bits;
        long [] otherArr = other.bits;
        int pos = Math.min(wlen, other.wlen);
        while (--pos >= 0)
        {
            thisArr[pos] ^= otherArr[pos];
        }
        if (this.wlen < newLen)
        {
            System.arraycopy(otherArr, this.wlen, thisArr, this.wlen, newLen - this.wlen);
        }
        this.wlen = newLen;
    }
119421
@Pure
	@Inline(value="($1 | $2)", constantExpression=true)
	public static long bitwiseOr(long a, long b) {
		return a | b;
	}
864034
static Object bigIntegerBinaryOperation(BigInteger lhs, BigInteger rhs, int kind)
    {

        switch(kind)
        {
            // arithmetic
            case PLUS:
                return lhs.add(rhs);

            case MINUS:
                return lhs.subtract(rhs);

            case STAR:
                return lhs.multiply(rhs);

            case SLASH:
                return lhs.divide(rhs);

            case MOD:
            case MODX:
                return lhs.mod(rhs);

            case POWER:
            case POWERX:
                return lhs.pow(rhs.intValue());

            // bitwise
            case LSHIFT:
            case LSHIFTX:
                return lhs.shiftLeft(rhs.intValue());

            case RSIGNEDSHIFT:
            case RSIGNEDSHIFTX:
                return lhs.shiftRight(rhs.intValue());

            case RUNSIGNEDSHIFT:
            case RUNSIGNEDSHIFTX:
                if ( lhs.signum() >= 0 )
                    return lhs.shiftRight(rhs.intValue());
                BigInteger opener = BigInteger.ONE.shiftLeft(lhs.toString(2).length() + 1);
                BigInteger opened = lhs.subtract(opener);
                BigInteger mask = opener.subtract(BigInteger.ONE).shiftRight(rhs.intValue() + 1);
                return opened.shiftRight(rhs.intValue()).and(mask);


            case BIT_AND:
            case BIT_ANDX:
                return lhs.and(rhs);

            case BIT_OR:
            case BIT_ORX:
                return lhs.or(rhs);

            case XOR:
            case XORX:
                return lhs.xor(rhs);

        }
        throw new InterpreterError(
                "Unimplemented binary integer operator");
    }
809909
function setbit(key, offset, value, req) {
  var buf = this.getValueBuffer(key, req, true)
    , zeros
    , pos
    , shift
    , byte
    , bit;
  if(buf === undefined) buf = new Buffer('');
  pos = Math.floor(offset / 8);
  bit = pos >= buf.length ? 0 : this.getbit(key, offset, req);

  if(pos + 1 >= buf.length) {
    zeros = new Buffer(pos + 1 - buf.length);
    zeros.fill('\u0000');
    buf = Buffer.concat([buf, zeros], buf.length + zeros.length);
  }

  shift = 7 - (offset & 0x7);
  byte = buf[pos];
  byte &= ~(1 << shift);
  byte |= ((value & 0x01) << shift);
  buf[pos] = byte;
  this.setKey(key, buf, undefined, undefined, undefined, req);
  return bit;
}
1005856
private static boolean isBinary(InputStream in) {
        try {
            int size = in.available();
            if (size > 1024) size = 1024;
            byte[] data = new byte[size];
            in.read(data);
            in.close();

            int ascii = 0;
            int other = 0;

            for (int i = 0; i < data.length; i++) {
                byte b = data[i];
                if (b < 0x09) return true;

                if (b == 0x09 || b == 0x0A || b == 0x0C || b == 0x0D) ascii++;
                else if (b >= 0x20 && b <= 0x7E) ascii++;
                else other++;
            }

            return other != 0 && 100 * other / (ascii + other) > 95;

        } catch (IOException e) {
            throw E.ioException(e);
        }
    }
1070052
public synchronized int setNextBit(boolean value) {
        increaseLength();
        index = (index + 1) % size;

        int previous = bitSet.set(index, value);
        int current = value ? 1 : 0;
        cardinality = cardinality - previous + current;
        return cardinality;
    }
823193
public Object bitwiseComplement(Object val) {
    long l = toLong(val);
    return Long.valueOf(~l);
  }
1230633
private static void xor(byte[] result, byte[] other) {
        for (int i = 0; i < result.length; ++i) {
            result[i] = (byte) (result[i] ^ other[i]);
        }
    }
1150198
function bitwise_or($x)
    {
        switch (MATH_BIGINTEGER_MODE) {
            case self::MODE_GMP:
                $temp = new static();
                $temp->value = gmp_or($this->value, $x->value);

                return $this->_normalize($temp);
            case self::MODE_BCMATH:
                $left = $this->toBytes();
                $right = $x->toBytes();

                $length = max(strlen($left), strlen($right));

                $left = str_pad($left, $length, chr(0), STR_PAD_LEFT);
                $right = str_pad($right, $length, chr(0), STR_PAD_LEFT);

                return $this->_normalize(new static($left | $right, 256));
        }

        $length = max(count($this->value), count($x->value));
        $result = $this->copy();
        $result->value = array_pad($result->value, $length, 0);
        $x->value = array_pad($x->value, $length, 0);

        for ($i = 0; $i < $length; ++$i) {
            $result->value[$i]|= $x->value[$i];
        }

        return $this->_normalize($result);
    }
624185
public final Assignment union(Assignment other) {
    Preconditions.checkNotNull(other);
    if (other.size() == 0) {
      return this;
    } if (vars.length == 0) {
      return other;
    }

    // Merge varnums / values
    int[] otherNums = other.getVariableNumsArray();
    int[] myNums = getVariableNumsArray();
    Object[] otherVals = other.getValuesArray();
    Object[] myVals = getValuesArray();

    int[] mergedNums = new int[otherNums.length + myNums.length];
    Object[] mergedVals = new Object[otherNums.length + myNums.length];

    int i = 0;
    int j = 0;
    int numFilled = 0;
    while (i < otherNums.length && j < myNums.length) {
      if (otherNums[i] < myNums[j]) {
        mergedNums[numFilled] = otherNums[i];
        mergedVals[numFilled] = otherVals[i];
        i++;
        numFilled++;
      } else if (otherNums[i] > myNums[j]) {
        mergedNums[numFilled] = myNums[j];
        mergedVals[numFilled] = myVals[j];
        j++;
        numFilled++;
      } else {
        Preconditions.checkState(false, "Cannot combine non-disjoint assignments: %s with %s", this, other);
      }
    }
    // One list might still have elements in it.
    while (i < otherNums.length) {
      mergedNums[numFilled] = otherNums[i];
      mergedVals[numFilled] = otherVals[i];
      i++;
      numFilled++;
    }
    while (j < myNums.length) {
      mergedNums[numFilled] = myNums[j];
      mergedVals[numFilled] = myVals[j];
      j++;
      numFilled++;
    }
    Preconditions.checkState(numFilled == mergedNums.length);
    return Assignment.fromSortedArrays(mergedNums, mergedVals);
  }
1236264
function(other) {

    // If sign bits differ ...
    if ((this.buffer[this.offset] & 0x80) != (other.buffer[other.offset] & 0x80)) {
      return other.buffer[other.offset] - this.buffer[this.offset];
    }

    // otherwise, compare bytes lexicographically
    for (var i = 0; i < 8; i++) {
      if (this.buffer[this.offset+i] !== other.buffer[other.offset+i]) {
        return this.buffer[this.offset+i] - other.buffer[other.offset+i];
      }
    }
    return 0;
  }
1205937
public static int equal(int b, int c) {
    int result = 0;
    int xor = b ^ c;
    for (int i = 0; i < 8; i++) {
      result |= xor >> i;
    }
    return (result ^ 0x01) & 0x01;
  }
613718
public Bits andSet(Bits xs) {
        Assert.check(currentState != BitsState.UNKNOWN);
        internalAndSet(xs);
        currentState = BitsState.NORMAL;
        return this;
    }
1238320
int set(int bitIndex, boolean value) {
        int wordIndex = wordIndex(bitIndex);
        long bitMask = 1L << bitIndex;
        int previous = (words[wordIndex] & bitMask) != 0 ? 1 : 0;
        if (value) {
            words[wordIndex] |= bitMask;
        } else {
            words[wordIndex] &= ~bitMask;
        }
        return previous;
    }
1113135
def int2baseTwo(x):
    """"""
    # repeating x >>= 1 and x & 1 will do the trick
    assert x >= 0
    bitInverse = []
    while x != 0:
        bitInverse.append(x & 1)
        x >>= 1
    return bitInverse