Files
MP-SPDZ/Math/Integer.cpp
Marcel Keller cc0711c224 MP-SPDZ.
2018-10-11 17:20:26 +11:00

34 lines
473 B
C++

/*
* Integer.cpp
*
*/
#include "Integer.h"
void IntBase::output(ostream& s,bool human) const
{
if (human)
s << a;
else
s.write((char*)&a, sizeof(a));
}
void IntBase::input(istream& s,bool human)
{
if (human)
s >> a;
else
s.read((char*)&a, sizeof(a));
}
void to_signed_bigint(bigint& res, const Integer& x, int n)
{
res = abs(x.get());
bigint& tmp = bigint::tmp = 1;
tmp <<= n;
tmp -= 1;
res &= tmp;
if (x < 0)
res.negate();
}