diff options
Diffstat (limited to 'third_party/bigint/BigInteger.hh')
-rw-r--r-- | third_party/bigint/BigInteger.hh | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/third_party/bigint/BigInteger.hh b/third_party/bigint/BigInteger.hh index cf6e91056f..a239d3c954 100644 --- a/third_party/bigint/BigInteger.hh +++ b/third_party/bigint/BigInteger.hh @@ -1,3 +1,9 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// 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 @@ -157,14 +163,24 @@ inline BigInteger BigInteger::operator *(const BigInteger &x) const { return ans; } inline BigInteger BigInteger::operator /(const BigInteger &x) const { - if (x.isZero()) throw "BigInteger::operator /: division by zero"; + if (x.isZero()) +#ifdef FOXIT_CHROME_BUILD + abort(); +#else + throw "BigInteger::operator /: division by zero"; +#endif BigInteger q, r; r = *this; r.divideWithRemainder(x, q); return q; } inline BigInteger BigInteger::operator %(const BigInteger &x) const { - if (x.isZero()) throw "BigInteger::operator %: division by zero"; + if (x.isZero()) +#ifdef FOXIT_CHROME_BUILD + abort(); +#else + throw "BigInteger::operator %: division by zero"; +#endif BigInteger q, r; r = *this; r.divideWithRemainder(x, q); @@ -193,7 +209,12 @@ inline void BigInteger::operator *=(const BigInteger &x) { multiply(*this, x); } inline void BigInteger::operator /=(const BigInteger &x) { - if (x.isZero()) throw "BigInteger::operator /=: division by zero"; + if (x.isZero()) +#ifdef FOXIT_CHROME_BUILD + abort(); +#else + throw "BigInteger::operator /=: division by zero"; +#endif /* The following technique is slightly faster than copying *this first * when x is large. */ BigInteger q; @@ -202,7 +223,12 @@ inline void BigInteger::operator /=(const BigInteger &x) { *this = q; } inline void BigInteger::operator %=(const BigInteger &x) { - if (x.isZero()) throw "BigInteger::operator %=: division by zero"; + if (x.isZero()) +#ifdef FOXIT_CHROME_BUILD + abort(); +#else + throw "BigInteger::operator %=: division by zero"; +#endif BigInteger q; // Mods *this by x. Don't care about quotient left in q. divideWithRemainder(x, q); |