X-Git-Url: https://mattmccutchen.net/bigint/bigint.git/blobdiff_plain/b1f5f69ee6a55e326f1336a3967513fd22f57d7f..a82332d03045a6029b01b694cdca1acdb85ecadf:/BigUnsigned.hh diff --git a/BigUnsigned.hh b/BigUnsigned.hh index a587b7c..3e7aa10 100644 --- a/BigUnsigned.hh +++ b/BigUnsigned.hh @@ -1,6 +1,5 @@ /* * Matt McCutchen's Big Integer Library -* http://hashproduct.metaesthetics.net/bigint/ */ #ifndef BIGUNSIGNED @@ -104,8 +103,14 @@ class BigUnsigned : protected NumberlikeArray { // Compares this to x like Perl's <=> CmpRes compareTo(const BigUnsigned &x) const; // Normal comparison operators - NumberlikeArray::operator ==; // (NlA) The body used to be `{ return compareTo(x) == equal; }'. For performance reasons we use NumberlikeArray code that only worries about (in)equality and doesn't waste time determining which is bigger - NumberlikeArray::operator !=; // (NlA) Ditto. + // Bug fixed 2006.04.24: Only we, not the user, can pass a BigUnsigned off as a + // NumberlikeArray, so we have to wrap == and !=. + bool operator ==(const BigUnsigned &x) const { + return NumberlikeArray::operator ==(x); + } + bool operator !=(const BigUnsigned &x) const { + return NumberlikeArray::operator !=(x); + } bool operator < (const BigUnsigned &x) const { return compareTo(x) == less ; } bool operator <=(const BigUnsigned &x) const { return compareTo(x) != greater; } bool operator >=(const BigUnsigned &x) const { return compareTo(x) != less ; }