BigInteger.setBit C# (CSharp) Method

setBit() public method

public setBit ( uint bitNum ) : void
bitNum uint
return void
        public void setBit(uint bitNum)
        {
                uint bytePos = bitNum >> 5;             // divide by 32
                byte bitPos = (byte)(bitNum & 0x1F);    // get the lowest 5 bits

                uint mask = (uint)1 << bitPos;
                this.data[bytePos] |= mask;

                if(bytePos >= this.dataLength)
                        this.dataLength = (int)bytePos + 1;
        }

Usage Example

Ejemplo n.º 1
0
		protected override BigInteger GenerateSearchBase (int bits, object Context) 
		{
			if (Context == null) throw new ArgumentNullException ("Context");
			BigInteger ret = new BigInteger ((BigInteger)Context);
			ret.setBit (0);
			return ret;
		}
All Usage Examples Of BigInteger::setBit