summaryrefslogtreecommitdiff
path: root/third_party/bigint/BigInteger.cc
diff options
context:
space:
mode:
authorJohn Abd-El-Malek <jam@chromium.org>2014-12-12 17:47:56 -0800
committerJohn Abd-El-Malek <jam@chromium.org>2014-12-12 17:47:56 -0800
commitf6505100fc132ef866adaf3ff1fb7f06d0ca7a9b (patch)
tree73497690daaf5c7f810a4c2a8fa1047c59f738a0 /third_party/bigint/BigInteger.cc
parent217ecf3b39f8d5c01260684848a8886c8ed2bf89 (diff)
downloadpdfium-f6505100fc132ef866adaf3ff1fb7f06d0ca7a9b.tar.xz
TBR=tsepez Review URL: https://codereview.chromium.org/804463003
Diffstat (limited to 'third_party/bigint/BigInteger.cc')
-rw-r--r--third_party/bigint/BigInteger.cc34
1 files changed, 0 insertions, 34 deletions
diff --git a/third_party/bigint/BigInteger.cc b/third_party/bigint/BigInteger.cc
index bac578f974..93b57e4255 100644
--- a/third_party/bigint/BigInteger.cc
+++ b/third_party/bigint/BigInteger.cc
@@ -20,11 +20,7 @@ BigInteger::BigInteger(const Blk *b, Index blen, Sign s) : mag(b, blen) {
switch (s) {
case zero:
if (!mag.isZero())
-#ifdef FOXIT_CHROME_BUILD
abort();
-#else
- throw "BigInteger::BigInteger(const Blk *, Index, Sign): Cannot use a sign of zero with a nonzero magnitude";
-#endif
sign = zero;
break;
case positive:
@@ -35,11 +31,7 @@ BigInteger::BigInteger(const Blk *b, Index blen, Sign s) : mag(b, blen) {
default:
/* g++ seems to be optimizing out this case on the assumption
* that the sign is a valid member of the enumeration. Oh well. */
-#ifdef FOXIT_CHROME_BUILD
abort();
-#else
- throw "BigInteger::BigInteger(const Blk *, Index, Sign): Invalid sign";
-#endif
}
}
@@ -47,11 +39,7 @@ BigInteger::BigInteger(const BigUnsigned &x, Sign s) : mag(x) {
switch (s) {
case zero:
if (!mag.isZero())
-#ifdef FOXIT_CHROME_BUILD
abort();
-#else
- throw "BigInteger::BigInteger(const BigUnsigned &, Sign): Cannot use a sign of zero with a nonzero magnitude";
-#endif
sign = zero;
break;
case positive:
@@ -62,11 +50,7 @@ BigInteger::BigInteger(const BigUnsigned &x, Sign s) : mag(x) {
default:
/* g++ seems to be optimizing out this case on the assumption
* that the sign is a valid member of the enumeration. Oh well. */
-#ifdef FOXIT_CHROME_BUILD
abort();
-#else
- throw "BigInteger::BigInteger(const BigUnsigned &, Sign): Invalid sign";
-#endif
}
}
@@ -114,12 +98,7 @@ inline X convertBigUnsignedToPrimitiveAccess(const BigUnsigned &a) {
template <class X>
X BigInteger::convertToUnsignedPrimitive() const {
if (sign == negative)
-#ifdef FOXIT_CHROME_BUILD
abort();
-#else
- throw "BigInteger::to<Primitive>: "
- "Cannot convert a negative integer to an unsigned type";
-#endif
else
return convertBigUnsignedToPrimitiveAccess<X>(mag);
}
@@ -146,12 +125,7 @@ X BigInteger::convertToSignedPrimitive() const {
}
// Otherwise fall through.
}
-#ifdef FOXIT_CHROME_BUILD
abort();
-#else
- throw "BigInteger::to<Primitive>: "
- "Value is too big to fit in the requested type";
-#endif
}
unsigned long BigInteger::toUnsignedLong () const { return convertToUnsignedPrimitive<unsigned long > (); }
@@ -179,11 +153,7 @@ BigInteger::CmpRes BigInteger::compareTo(const BigInteger &x) const {
// Compare the magnitudes, but return the opposite result
return CmpRes(-mag.compareTo(x.mag));
default:
-#ifdef FOXIT_CHROME_BUILD
abort();
-#else
- throw "BigInteger internal error";
-#endif
}
}
@@ -315,11 +285,7 @@ void BigInteger::divideWithRemainder(const BigInteger &b, BigInteger &q) {
// Defend against aliased calls;
// same idea as in BigUnsigned::divideWithRemainder .
if (this == &q)
-#ifdef FOXIT_CHROME_BUILD
abort();
-#else
- throw "BigInteger::divideWithRemainder: Cannot write quotient and remainder into the same variable";
-#endif
if (this == &b || &q == &b) {
BigInteger tmpB(b);
divideWithRemainder(tmpB, q);