Adds a clause that checks whether ANY set bits in a bitmask are present
in a numeric expression.

@param expr
SQL numeric expression to check.
@param bits
Integer containing the bits for which to check.
322418
public static Predicate anyBitsSet(final String expr, final long bits) {
        return new Predicate() {
            private String param;
            public void init(AbstractSqlCreator creator) {
                param = creator.allocateParameter();
                creator.setParameter(param, bits);
            }
            public String toSql() {
                return String.format("(%s & :%s) > 0", expr, param);
            }
        };
    }
1296799
public void excludeFrom(int start) {
        Assert.check(currentState != BitsState.UNKNOWN);
        Bits temp = new Bits();
        temp.sizeTo(bits.length);
        temp.inclRange(0, start);
        internalAndSet(temp);
        currentState = BitsState.NORMAL;
    }
1217899
private boolean verifyGhostBitsClear() {
		for (int i = numWords; i < bits.length; i++) {
			if (bits[i] != 0)
				return false;
		}

		if ((numBits & 0x3f) == 0)
			return true;

		long mask = -1L << numBits;

		return (bits[numWords - 1] & mask) == 0;
	}
963626
public void setExpression(Expression exp)
  {
  	if(null != m_mainExp)
    	exp.exprSetParent(m_mainExp.exprGetParent()); // a bit bogus
    m_mainExp = exp;
  }
1068622
public static Bit valueOf(String bit) throws NumberFormatException {
    final int i = ParseUtil.parseIntBase10(bit);
    if(i != 0 && i != 1) {
      throw new NumberFormatException("Input \"" + bit + "\" must be 0 or 1.");
    }
    return (i > 0) ? TRUE : FALSE;
  }
615004
public boolean is(ComparisonExpression expr) {
		try {
			if (expr != null) {
				return expr.evaluate(node);
			}
		} catch (MissingNodeException e) {
			return false;
		}

		return false;
	}
268489
public void append(short bits) {
        long l;
        long[] a1;
        l = ((l = crc) >> 8L) ^ (a1 = CRC32_TABLE)[(int) ((l & 0xFF) ^ (long) (bits & 0xFF))];
        crc = (l >> 8L) ^ a1[(int) ((l & 0xFF) ^ (long) ((bits & 0xffff) >> 8))];
    }
985010
public void expect(final Bits bits) throws IOException {
    int size = Math.min(availible(), bits.bitLength);
    Bits read = read(size);
    if (!bits.range(0, size).equals(read)) {
      throw new RuntimeException(String.format("%s is not expected %s", read, bits));
    }
  }
996018
private void calculate(String mask) {
        Matcher matcher = cidrPattern.matcher(mask);

        if (matcher.matches()) {
            matchAddress(matcher);

            /* Create a binary netmask from the number of bits specification /x */
            rangeCheck(Integer.parseInt(matcher.group(5)), 0, NBITS);
        } else {
            throw new IllegalArgumentException("Could not parse [" + mask + "]");
        }
    }
1064047
@Override
	public void visitBitwiseComplement(Expr.BitwiseComplement expr, Boolean consumed) {
		visitExpression(expr.getOperand(),false);
	}
703279
private static int bitLength(final int bits) {
        int correct = bits;
        if (bits != SiHmac.HMAC256
            && bits != SiHmac.HMAC384
            && bits != SiHmac.HMAC512) {
            correct = SiHmac.HMAC256;
        }
        return correct;
    }
457672
public static boolean isBinaryExpressionType(Expression expression, List<String> tokens) {
        if (expression instanceof BinaryExpression) {
            if (tokens.contains(((BinaryExpression) expression).getOperation().getText())) {
                return true;
            }
        }
        return false;
    }
414170
public final void splitByMask(AbstractNode<E> newNode, long[] assignment) {
    assert (isLeaf() == newNode.isLeaf());
    int dest = BitsUtil.nextSetBit(assignment, 0);
    if(dest < 0) {
      throw new AbortException("No bits set in splitting mask.");
    }
    // FIXME: use faster iteration/testing
    int pos = dest;
    while(pos < numEntries) {
      if(BitsUtil.get(assignment, pos)) {
        // Move to new node
        newNode.addEntry(getEntry(pos));
      }
      else {
        // Move to new position
        entries[dest] = entries[pos];
        dest++;
      }
      pos++;
    }
    final int rm = numEntries - dest;
    while(dest < numEntries) {
      entries[dest] = null;
      dest++;
    }
    numEntries -= rm;
  }
475020
boolean get(int bitIndex) {
        int wordIndex = wordIndex(bitIndex);
        long bitMask = 1L << bitIndex;
        return (words[wordIndex] & bitMask) != 0;
    }
956106
private void doWrite(int bits, int count) {

		int frontBits = ((int) position) & 31;
		int firstInt = (int) (position >> 5);

		int sumBits = count + frontBits;
		if (sumBits <= 32) {
			int i = ints[firstInt];
			int mask = frontMask(frontBits) | backMask(sumBits);
			i &= mask;
			i |= (bits << (32 - sumBits)) & ~mask;
			ints[firstInt] = i;
		} else {
			int i = ints[firstInt];
			int mask = frontMask(frontBits);
			i &= mask;
			int lostBits = sumBits - 32;
			i |= (bits >> lostBits) & ~mask;
			ints[firstInt] = i;

			i = ints[firstInt + 1];
			mask = backMask(lostBits);
			i &= mask;
			i |= (bits << (32 - lostBits)) & ~mask;
			ints[firstInt + 1] = i;
		}
	}
816079
public final void xor(ThreadSafeBitSet other) {
        if (other.size != size) throw new IllegalArgumentException("BitSets must be of equal size");
        for (int i = 0; i < bits.length; i++) {
            bits[i] ^= other.bits[i];
        }
    }
311125
def set_from_bits(self, value: int):
        
        if self.signed:
            value = -(value & self.tcmask) + (value & ~self.tcmask)
        self.set(value)