Home | History | Annotate | Download | only in bigint

Lines Matching full:bigunsigned

12 /* A BigUnsigned object represents a nonnegative integer of size limited only by
19 class BigUnsigned : protected NumberlikeArray<unsigned long> {
32 // Creates a BigUnsigned with a capacity; for internal use.
33 BigUnsigned(int, Index c) : NumberlikeArray<Blk>(0, c) {}
43 BigUnsigned() : NumberlikeArray<Blk>() {}
46 BigUnsigned(const BigUnsigned &x) : NumberlikeArray<Blk>(x) {}
49 void operator=(const BigUnsigned &x) {
54 BigUnsigned(const Blk *b, Index blen) : NumberlikeArray<Blk>(b, blen) {
60 ~BigUnsigned() {}
63 BigUnsigned(unsigned long x);
64 BigUnsigned( long x);
65 BigUnsigned(unsigned int x);
66 BigUnsigned( int x);
67 BigUnsigned(unsigned short x);
68 BigUnsigned( short x);
121 CmpRes compareTo(const BigUnsigned &x) const;
124 bool operator ==(const BigUnsigned &x) const {
127 bool operator !=(const BigUnsigned &x) const {
130 bool operator < (const BigUnsigned &x) const { return compareTo(x) == less ; }
131 bool operator <=(const BigUnsigned &x) const { return compareTo(x) != greater; }
132 bool operator >=(const BigUnsigned &x) const { return compareTo(x) != less ; }
133 bool operator > (const BigUnsigned &x) const { return compareTo(x) == greater; }
136 * BigUnsigned and BigInteger both provide three kinds of operators.
137 * Here ``big-integer'' refers to BigInteger or BigUnsigned.
184 void add(const BigUnsigned &a, const BigUnsigned &b);
185 void subtract(const BigUnsigned &a, const BigUnsigned &b);
186 void multiply(const BigUnsigned &a, const BigUnsigned &b);
187 void bitAnd(const BigUnsigned &a, const BigUnsigned &b);
188 void bitOr(const BigUnsigned &a, const BigUnsigned &b);
189 void bitXor(const BigUnsigned &a, const BigUnsigned &b);
192 void bitShiftLeft(const BigUnsigned &a, int b);
193 void bitShiftRight(const BigUnsigned &a, int b);
198 * implementation in BigUnsigned.cc for details.
201 void divideWithRemainder(const BigUnsigned &b, BigUnsigned &q);
207 BigUnsigned operator +(const BigUnsigned &x) const;
208 BigUnsigned operator -(const BigUnsigned &x) const;
209 BigUnsigned operator *(const BigUnsigned &x) const;
210 BigUnsigned operator /(const BigUnsigned &x) const;
211 BigUnsigned operator %(const BigUnsigned &x) const;
214 BigUnsigned operator &(const BigUnsigned &x) const;
215 BigUnsigned operator |(const BigUnsigned &x) const;
216 BigUnsigned operator ^(const BigUnsigned &x) const;
217 BigUnsigned operator <<(int b) const;
218 BigUnsigned operator >>(int b) const;
221 void operator +=(const BigUnsigned &x);
222 void operator -=(const BigUnsigned &x);
223 void operator *=(const BigUnsigned &x);
224 void operator /=(const BigUnsigned &x);
225 void operator %=(const BigUnsigned &x);
226 void operator &=(const BigUnsigned &x);
227 void operator |=(const BigUnsigned &x);
228 void operator ^=(const BigUnsigned &x);
240 // Helper function that needs access to BigUnsigned internals
241 friend Blk getShiftedBlock(const BigUnsigned &num, Index x,
246 friend X convertBigUnsignedToPrimitiveAccess(const BigUnsigned &a);
253 inline BigUnsigned BigUnsigned::operator +(const BigUnsigned &x) const {
254 BigUnsigned ans;
258 inline BigUnsigned BigUnsigned::operator -(const BigUnsigned &x) const {
259 BigUnsigned ans;
263 inline BigUnsigned BigUnsigned::operator *(const BigUnsigned &x) const {
264 BigUnsigned ans;
268 inline BigUnsigned BigUnsigned::operator /(const BigUnsigned &x) const {
271 BigUnsigned q, r;
276 inline BigUnsigned BigUnsigned::operator %(const BigUnsigned &x) const {
279 BigUnsigned q, r;
284 inline BigUnsigned BigUnsigned::operator &(const BigUnsigned &x) const {
285 BigUnsigned ans;
289 inline BigUnsigned BigUnsigned::operator |(const BigUnsigned &x) const {
290 BigUnsigned ans;
294 inline BigUnsigned BigUnsigned::operator ^(const BigUnsigned &x) const {
295 BigUnsigned ans;
299 inline BigUnsigned BigUnsigned::operator <<(int b) const {
300 BigUnsigned ans;
304 inline BigUnsigned BigUnsigned::operator >>(int b) const {
305 BigUnsigned ans;
310 inline void BigUnsigned::operator +=(const BigUnsigned &x) {
313 inline void BigUnsigned::operator -=(const BigUnsigned &x) {
316 inline void BigUnsigned::operator *=(const BigUnsigned &x) {
319 inline void BigUnsigned::operator /=(const BigUnsigned &x) {
324 BigUnsigned q;
329 inline void BigUnsigned::operator %=(const BigUnsigned &x) {
332 BigUnsigned q;
336 inline void BigUnsigned::operator &=(const BigUnsigned &x) {
339 inline void BigUnsigned::operator |=(const BigUnsigned &x) {
342 inline void BigUnsigned::operator ^=(const BigUnsigned &x) {
345 inline void BigUnsigned::operator <<=(int b) {
348 inline void BigUnsigned::operator >>=(int b) {
352 /* Templates for conversions of BigUnsigned to and from primitive integers.
354 * BigUnsigned.cc didn't do the trick; I think g++ inlined convertToPrimitive
360 /* Initialize this BigUnsigned from the given primitive integer. The same
366 void BigUnsigned::initFromPrimitive(X x) {
383 void BigUnsigned::initFromSignedPrimitive(X x) {
396 X BigUnsigned::convertToPrimitive() const {
417 X BigUnsigned::convertToSignedPrimitive() const {