mirror of
https://github.com/QuasarApp/qca.git
synced 2025-05-03 06:39:33 +00:00
expose bigint mul,div,mod functions
svn path=/trunk/kdesupport/qca/; revision=703509
This commit is contained in:
parent
0046132348
commit
51adb11e2d
@ -642,6 +642,27 @@ a -= b; // a is now -1000
|
|||||||
*/
|
*/
|
||||||
BigInteger & operator-=(const BigInteger &b);
|
BigInteger & operator-=(const BigInteger &b);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Multiply in place operator
|
||||||
|
|
||||||
|
\param b the amount to multiply by
|
||||||
|
*/
|
||||||
|
BigInteger & operator*=(const BigInteger &b);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Divide in place operator
|
||||||
|
|
||||||
|
\param b the amount to divide by
|
||||||
|
*/
|
||||||
|
BigInteger & operator/=(const BigInteger &b);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Modulo in place operator
|
||||||
|
|
||||||
|
\param b the amount to divide by
|
||||||
|
*/
|
||||||
|
BigInteger & operator%=(const BigInteger &b);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Output %BigInteger as a byte array, useful for storage or
|
Output %BigInteger as a byte array, useful for storage or
|
||||||
transmission. The format is a binary integer in sign-extended
|
transmission. The format is a binary integer in sign-extended
|
||||||
|
@ -846,6 +846,40 @@ BigInteger & BigInteger::operator-=(const BigInteger &i)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BigInteger & BigInteger::operator*=(const BigInteger &i)
|
||||||
|
{
|
||||||
|
d->n *= i.d->n;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
BigInteger & BigInteger::operator/=(const BigInteger &i)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
d->n /= i.d->n;
|
||||||
|
}
|
||||||
|
catch(std::exception &)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "QCA: Botan integer division error\n");
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
BigInteger & BigInteger::operator%=(const BigInteger &i)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
d->n %= i.d->n;
|
||||||
|
}
|
||||||
|
catch(std::exception &)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "QCA: Botan integer division error\n");
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
BigInteger & BigInteger::operator=(const QString &s)
|
BigInteger & BigInteger::operator=(const QString &s)
|
||||||
{
|
{
|
||||||
fromString(s);
|
fromString(s);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user