friend BigUInt operator + (const BigUInt &left, const BigUInt &right) { BigUInt result; unsigned int i; if (left.m_data.size() > right.m_data.size()) { result.resize(left.m_data.size()); for (i=0; i < right.m_data.size(); ++i) { result.m_data[i] = left.m_data[i] + right.m_data[i]; } for (; i< left.m_data.size(); ++i) { result.m_data[i] = left.m_data[i]; } } else { result.resize(right.m_data.size()); for (i=0; i < left.m_data.size(); ++i) { result.m_data[i] = left.m_data[i] + right.m_data[i]; } for (; i< right.m_data.size(); ++i) { result.m_data[i] = right.m_data[i]; } } result.normalize(); return result; }
static BigUInt multOffset(const BigUInt &left, int value, int offset) { BigUInt result; result.resize(offset + left.m_data.size()); for (unsigned int i=0; i < left.m_data.size(); ++i) { result.m_data[i+offset] = left.m_data[i] * value; } result.normalize(); return result; }