Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Unified Diff: third_party/bigint/BigInteger.hh

Issue 754743003: Modify big integer library (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Add copyright notice Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/bigint/BigInteger.hh
diff --git a/third_party/bigint/BigInteger.hh b/third_party/bigint/BigInteger.hh
index cf6e91056f4519a87049993faaab57e2bfbd4177..b6570edfec0bbdc738adac318503699501d84c3e 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);

Powered by Google App Engine
This is Rietveld 408576698