Make Integer representation little endian

This commit is contained in:
2017-04-19 13:49:44 +02:00
parent 628153e2e8
commit 4fa47153ba
2 changed files with 103 additions and 153 deletions

View File

@ -87,21 +87,20 @@ in
}
body
{
size_t i = y.length;
size_t i;
auto tmp1 = Integer(x, x.allocator);
auto result = Integer(x.allocator);
if (x.length == 0 && i != 0)
if (x.length == 0 && y.length != 0)
{
i = 0;
i = y.length;
}
else
{
result = 1;
}
while (i)
while (i < y.length)
{
--i;
for (ubyte mask = 0x01; mask; mask <<= 1)
{
if (y.rep[i] & mask)
@ -113,6 +112,7 @@ body
tmp1 *= tmp2;
tmp1 %= z;
}
++i;
}
return result;
}