public void IntGetBit() { using (var a = new HugeInt("0xA000000000000000000200000000001")) { var limbs = 128 / MpirSettings.BITS_PER_LIMB; Assert.IsTrue(a.GetBit(45)); Assert.IsFalse(a.GetBit(46)); Assert.AreEqual(limbs, a.NumberOfLimbsUsed()); Assert.AreEqual(limbs + 1, a.NumberOfLimbsAllocated()); Assert.IsFalse(a.GetBit(246)); Assert.AreEqual(limbs, a.NumberOfLimbsUsed()); Assert.AreEqual(limbs + 1, a.NumberOfLimbsAllocated()); a.Value = ~a; Assert.AreEqual(-limbs, a.NumberOfLimbsUsed()); Assert.AreEqual(limbs + 1, a.NumberOfLimbsAllocated()); Assert.IsTrue(a.GetBit(246)); Assert.AreEqual(-limbs, a.NumberOfLimbsUsed()); Assert.AreEqual(limbs + 1, a.NumberOfLimbsAllocated()); } }