CyrusBuilt.MonoPi.BitSet.XOr C# (CSharp) Method

XOr() public method

Performs a logical XOR of this bit set with the specified bit set. This bit set is modified so that a bit in it has the value true if and only if one of the following statements holds true:
- The bit initially has the value true, and the corresponding bit in the specified bit set has the value false.

- Thi bit initially has the value false, and the corresponding bit in the specified bit set has the value true.
/// cannot be null. ///
public XOr ( BitSet bs ) : void
bs BitSet /// A bit set. ///
return void
		public void XOr(BitSet bs) {
			if (bs == null) {
				throw new ArgumentNullException("bs");
			}

			// Calculate how many words with have in common with the other bit set.
			Int32 wordsInCommon = Math.Min(this._wordsInUse, bs._wordsInUse);
			if (this._wordsInUse < bs._wordsInUse) {
				this.EnsureCapacity(bs._wordsInUse);
				this._wordsInUse = bs._wordsInUse;
			}

			// Perform logical XOR on words in common.
			for (Int32 i = 0; i < wordsInCommon; i++) {
				this._bits[i] ^= bs._bits[i];
			}

			// Copy any remaining words.
			if (wordsInCommon < bs._wordsInUse) {
				Array.Copy(bs._bits, wordsInCommon, this._bits, wordsInCommon, bs._wordsInUse - wordsInCommon);
			}

			this.RecalculateWordsInUse();
			this.CheckInvariants();
		}