Francois Berder / BigInt
Revision:
5:beeb31f340a7
Parent:
4:773aed3156c5
Child:
6:29e78b169f40
--- a/BigInt.cpp	Fri Oct 04 10:46:51 2013 +0000
+++ b/BigInt.cpp	Fri Oct 04 12:38:42 2013 +0000
@@ -330,6 +330,20 @@
     return (*this = *this << m);
 }
 
+BigInt operator%(const BigInt &a, const BigInt &b)
+{
+    BigInt result = a;
+    while(result > b)
+        result -= b;
+
+    return result;
+}
+
+BigInt& BigInt::operator%=(const BigInt &a)
+{
+    return (*this = *this % a);
+}
+
 bool operator==(const BigInt &a, const BigInt &b)
 {
     if(a.size != b.size)