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.
Revision 25:3d5c1f299da2, committed 2014-04-13
- Comitter:
- feb11
- Date:
- Sun Apr 13 07:35:47 2014 +0000
- Parent:
- 24:a3453a18388c
- Child:
- 26:94e26bcd229d
- Commit message:
- removed warnings
Changed in this revision
| BigInt.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/BigInt.cpp Sun Apr 06 08:12:52 2014 +0000
+++ b/BigInt.cpp Sun Apr 13 07:35:47 2014 +0000
@@ -51,7 +51,7 @@
{
uint32_t l = num(size);
bits = new uint32_t[l];
- for(int i = 0; i < l; ++i)
+ for(int i = 0; i < (int)l; ++i)
bits[i] = a.bits[i];
}
@@ -71,7 +71,7 @@
if(bits)
delete[] bits;
bits = new uint32_t[l];
- for(int i = 0; i < l; ++i)
+ for(int i = 0; i < (int)l; ++i)
bits[i] = a.bits[i];
return *this;
}
@@ -83,7 +83,7 @@
delete[] bits;
bits = new uint32_t[num(size)];
memset(bits, 0, sizeof(uint32_t)*num(size));
- for(int i = 0; i < length; ++i)
+ for(int i = 0; i < (int)length; ++i)
bits[i/4] |= data[length-i-1] << ((i%4)*8);
trim();
@@ -114,12 +114,12 @@
uint32_t al = num(a.size);
uint32_t bl = num(b.size);
uint32_t carry = 0;
- for(int i = 0; i < l; ++i)
+ for(int i = 0; i < (int)l; ++i)
{
uint32_t tmpA = 0, tmpB = 0;
- if(i < al)
+ if(i < (int)al)
tmpA = a.bits[i];
- if(i < bl)
+ if(i < (int)bl)
tmpB = b.bits[i];
result.bits[i] = tmpA + tmpB + carry;
carry = result.bits[i] < std::max(tmpA, tmpB);
@@ -230,10 +230,10 @@
result.size = a.size + b.size;
result.bits = new uint32_t[num(result.size)];
memset(result.bits, 0, sizeof(uint32_t)*num(result.size));
- for(int i = 0; i < num(a.size); ++i)
+ for(int i = 0; i < (int)num(a.size); ++i)
{
uint64_t carry = 0;
- for(int j = 0; j < num(b.size); ++j)
+ for(int j = 0; j < (int)num(b.size); ++j)
{
uint64_t tmp = (uint64_t)a.bits[i] * (uint64_t)b.bits[j] + carry;
uint32_t t = result.bits[i+j];
@@ -379,7 +379,7 @@
return false;
uint32_t l = num(a.size);
- for(int i = 0; i < l; ++i)
+ for(int i = 0; i < (int)l; ++i)
if(a.bits[i] != b.bits[i])
return false;
return true;
@@ -611,12 +611,10 @@
{
assert(isValid());
- printf("size: %d bytes\n", size);
+ printf("size: %lu bytes\n", size);
uint32_t n = num(size);
for(int i = n-1; i >= 0; --i)
- {
- printf("%08x ", bits[i]);
- }
+ printf("%08x ", (int)bits[i]);
printf("\n");
}
@@ -635,12 +633,12 @@
}
uint32_t carry = 0;
- for(int i = 0; i < l; ++i)
+ for(int i = 0; i < (int)l; ++i)
{
uint32_t tmpA = 0, tmpB = 0;
- if(i < al)
+ if(i < (int)al)
tmpA = bits[i];
- if(i < bl)
+ if(i < (int)bl)
tmpB = b.bits[i];
bits[i] = tmpA + tmpB + carry;
carry = bits[i] < std::max(tmpA, tmpB);