Swap. Completed MPIR 2.6.0 section 5.2, except setting MPZ from MPQ or MPF
This commit is contained in:
parent
fc6bfb6f4a
commit
b4940574c0
@ -35,6 +35,20 @@ namespace MPIR.Tests.HugeIntTests
|
||||
Assert.AreEqual("-222509832503450298345029835740293845720", b.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Swap()
|
||||
{
|
||||
using (var a = new HugeInt("-222509832503450298345029835740293845720"))
|
||||
using (var b = new HugeInt("2039847290878794872059384789347534534"))
|
||||
{
|
||||
var aValue = a._value();
|
||||
var bValue = b._value();
|
||||
a.Swap(b);
|
||||
Assert.AreEqual(bValue, a._value());
|
||||
Assert.AreEqual(aValue, b._value());
|
||||
}
|
||||
}
|
||||
//more tests coming here
|
||||
}
|
||||
}
|
||||
|
@ -367,5 +367,8 @@ namespace MPIR
|
||||
void SetTo(double value) { mpz_set_d(_value, value); }
|
||||
void SetTo(String^ value) { SetTo(value, 10); }
|
||||
void SetTo(String^ value, int base);
|
||||
|
||||
//utility methods
|
||||
void Swap(HugeInt^ a) { mpz_ptr temp = a->_value; a->_value = _value; _value = temp; }
|
||||
};
|
||||
};
|
Loading…
Reference in New Issue
Block a user