Returns a new BitSet after ANDing this set with another
@param self $other
@return \static
339645
public function logicalAnd(self $other){
		
		$l = \max(array($this->count(), $other->count()));
		$new = new static();
		
		for($i = 0; $i < $l; ++$i){
			$new[$i] = isset($this[$i], $other[$i])
					? ($this[$i] && $other[$i])
					: false;
		}
		
		return $new;
		
	}
124955
def union_update(self, other):
        
        if not isinstance(other, Set):
            raise ValueError('other must be a Set instance')
        if self is other:
            return
        for item in other.items:
            self.add(item)
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];
        }
    }
314499
public function concat(...$others)
    {
        return static::of(
            Std::foldl(
                function ($carry, $part) {
                    return $carry . (string) $part;
                },
                $this->contents,
                $others
            ),
            $this->encoding
        );
    }
262154
public static function fromASN1(Set $set): self
    {
        $attribs = array_map(
            function (UnspecifiedType $el) {
                return AttributeTypeAndValue::fromASN1($el->asSequence());
            }, $set->elements());
        return new self(...$attribs);
    }
904150
public function add($other, array $options = []): Image
    {
        if (self::isImageish($other)) {
            return self::call('add', $this, [$other], $options);
        } else {
            return $this->linear(1, $other, $options);
        }
    }
168800
public function bitString(): BitString
    {
        $last_octet_bits = $this->_width % 8;
        $unused_bits = $last_octet_bits ? 8 - $last_octet_bits : 0;
        return new BitString($this->_flags, $unused_bits);
    }
330522
public function merge(self $otherMetadata): self
    {
        return new self(array_merge($this->values, $otherMetadata->values));
    }
763426
public function merge(self $other)
    {
        $new      = clone $this;
        $newWhere = $new->select->where;
        
        foreach ($other->select->where->getPredicates() as $pData) {
            $newWhere->addPredicate($pData[1], $pData[0]);
        }
        
        return $new;
    }
542120
public function replace($old, $new): self
    {
        Assert::typeOf(['string', __CLASS__], $old, $new);

        return new static(str_replace((string) $old, (string) $new, $this->data), $this->encoding);
    }
865683
public function bitSet($name, array $bits, $clean = true)
  {
    if ($clean) {
      $this->set($name, 0);
    }

    foreach ($bits as $b) {
      $this->bitAdd($name, $b);
    }

    return $this;
  }
1317323
public function prependAll($other): Seq
    {
        if (is_array($other)) {
            return new Seq(
                array_merge(
                    array_values($other),
                    $this->data
                )
            );
        }

        if ($other instanceof Seq) {
            return $other->appendAll($this->data);
        }

        throw new \InvalidArgumentException('`$other` must be `Seq` or `array`');
    }
466823
public function equals($other)
    {
        $value = $other instanceof Value ? $other->getValue() : $other;

        return $this->getValue() === $value;
    }
475425
public static BitSet bitwiseNegate(BitSet self) {
        BitSet result = (BitSet) self.clone();
        result.flip(0, result.size() - 1);
        return result;
    }
775209
public static function intersection(Set $a, Set $b) : Set
    {
        return new self(array_intersect($a->toArray(), $b->toArray()));
    }
148343
public function lessThan($other)
    {
        $this->doCheck(function ($value) use ($other) {
            $this->throwExceptionIfFalse(
                $value < $other,
                'Failed assertion that %s is less than %s', $value, $other
            );
        });

        return $this;
    }
628314
private function doSetBinaryBitsetLeBin($bitset): void
    {
        $size   = \strlen($this->bitset);
        $sizeIn = \strlen($bitset);

        if ($sizeIn < $size) {
            // add "\0" if the given bitset is not long enough
            $bitset .= \str_repeat("\0", $size - $sizeIn);
        } elseif ($sizeIn > $size) {
            if (\ltrim(\substr($bitset, $size), "\0") !== '') {
                throw new InvalidArgumentException('out-of-range bits detected');
            }
            $bitset = \substr($bitset, 0, $size);
        }

        // truncate out-of-range bits of last byte
        $lastByteMaxOrd = $this->enumerationCount % 8;
        if ($lastByteMaxOrd !== 0) {
            $lastByte         = $bitset[-1];
            $lastByteExpected = \chr((1 << $lastByteMaxOrd) - 1) & $lastByte;
            if ($lastByte !== $lastByteExpected) {
                throw new InvalidArgumentException('out-of-range bits detected');
            }

            $this->bitset = \substr($bitset, 0, -1) . $lastByteExpected;
        }

        $this->bitset = $bitset;
    }