Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: BigInt.cpp
- 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)