// Copyright 2014 The PDFium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Original code by Matt McCutchen, see the LICENSE file. #ifndef BIGINTEGER_H #define BIGINTEGER_H #include "BigUnsigned.hh" /* A BigInteger object represents a signed integer of size limited only by * available memory. BigUnsigneds support most mathematical operators and can * be converted to and from most primitive integer types. * * A BigInteger is just an aggregate of a BigUnsigned and a sign. (It is no * longer derived from BigUnsigned because that led to harmful implicit * conversions.) */ class BigInteger { … }; // NORMAL OPERATORS /* These create an object to hold the result and invoke * the appropriate put-here operation on it, passing * this and x. The new object is then returned. */ inline BigInteger BigInteger::operator +(const BigInteger &x) const { … } inline BigInteger BigInteger::operator -(const BigInteger &x) const { … } inline BigInteger BigInteger::operator *(const BigInteger &x) const { … } inline BigInteger BigInteger::operator /(const BigInteger &x) const { … } inline BigInteger BigInteger::operator %(const BigInteger &x) const { … } inline BigInteger BigInteger::operator -() const { … } /* * ASSIGNMENT OPERATORS * * Now the responsibility for making a temporary copy if necessary * belongs to the put-here operations. See Assignment Operators in * BigUnsigned.hh. */ inline BigInteger& BigInteger::operator +=(const BigInteger &x) { … } inline BigInteger& BigInteger::operator -=(const BigInteger &x) { … } inline BigInteger& BigInteger::operator *=(const BigInteger &x) { … } inline BigInteger& BigInteger::operator /=(const BigInteger &x) { … } inline BigInteger& BigInteger::operator %=(const BigInteger &x) { … } // This one is trivial inline void BigInteger::flipSign() { … } #endif