X-Git-Url: https://mattmccutchen.net/bigint/bigint.git/blobdiff_plain/6e1e0f2f3c2fee3e1e9df39c6d4816566c10aafb..e6866cd00f91dd02fb54942d61fb1586ce0ed5b5:/BigUnsignedInABase.hh diff --git a/BigUnsignedInABase.hh b/BigUnsignedInABase.hh index 737d877..6925151 100644 --- a/BigUnsignedInABase.hh +++ b/BigUnsignedInABase.hh @@ -1,9 +1,5 @@ -/* - * Matt McCutchen's Big Integer Library - */ - -#ifndef BIGUNSIGNEDINABASE -#define BIGUNSIGNEDINABASE +#ifndef BIGUNSIGNEDINABASE_H +#define BIGUNSIGNEDINABASE_H #include "NumberlikeArray.hh" #include "BigUnsigned.hh" @@ -39,16 +35,16 @@ class BigUnsignedInABase : protected NumberlikeArray { // TYPES - public: +public: typedef unsigned short Digit; // The digit type that BigUnsignedInABases are built from typedef Digit Base; // FIELDS - protected: +protected: Base base; // The base of this BigUnsignedInABase // MANAGEMENT - protected: +protected: // These members generally defer to those in NumberlikeArray, possibly with slight changes. // It might be nice if one could request that constructors be inherited in C++. @@ -62,7 +58,7 @@ class BigUnsignedInABase : protected NumberlikeArray { //void allocate(Index c); // (NlA) Ensures the number array has at least the indicated capacity, maybe discarding contents //void allocateAndCopy(Index c); // (NlA) Ensures the number array has at least the indicated capacity, preserving its contents - public: +public: BigUnsignedInABase() : NumberlikeArray(), base(2) {} // Default constructor (value is 0 in base 2) BigUnsignedInABase(const BigUnsignedInABase &x) : NumberlikeArray(x), base(x.base) {} // Copy constructor @@ -100,7 +96,7 @@ class BigUnsignedInABase : protected NumberlikeArray { // PICKING APART // These accessors can be used to get the pieces of the number - public: +public: Base getBase() const { return base; } NumberlikeArray::getCapacity; // (NlA) NumberlikeArray::getLength; // (NlA) @@ -111,7 +107,7 @@ class BigUnsignedInABase : protected NumberlikeArray { bool isZero() const { return NumberlikeArray::isEmpty(); } // Often convenient for loops // EQUALITY TEST - public: +public: // Equality test bool operator ==(const BigUnsignedInABase &x) const { return base == x.base && NumberlikeArray::operator ==(x);