65#if defined __GNUG__ || defined __alpha
110 inline void allocate(
unsigned digits);
111 inline void reallocate(
unsigned digits);
112 inline void resize(
unsigned digits);
115 inline void adjust();
122 inline int ucompare(
BigInt const &)
const;
124 void mul(
onedig_t const *,
unsigned,
bool);
169 bool dump(
unsigned char *,
unsigned)
const;
170 void load(
unsigned char const *,
unsigned);
177 return length <=
small;
232 return length != 0 && digit[0] & 1;
244 positive = !positive;
254#define IN_PLACE_OPERATOR(TYPE) \
255 BigInt &operator+=(TYPE); \
256 BigInt &operator-=(TYPE); \
257 BigInt &operator*=(TYPE); \
258 BigInt &operator/=(TYPE); \
259 BigInt &operator%=(TYPE);
264#undef IN_PLACE_OPERATOR
266#define OVERLOAD_IN_PLACE_OPERATOR(FROM, TO) \
267 BigInt &operator+=(FROM x) \
269 return operator+=(static_cast<TO>(x)); \
271 BigInt &operator-=(FROM x) \
273 return operator-=(static_cast<TO>(x)); \
275 BigInt &operator*=(FROM x) \
277 return operator*=(static_cast<TO>(x)); \
279 BigInt &operator/=(FROM x) \
281 return operator/=(static_cast<TO>(x)); \
283 BigInt &operator%=(FROM x) \
285 return operator%=(static_cast<TO>(x)); \
292#undef OVERLOAD_IN_PLACE_OPERATOR
296 return operator+=(1);
327 std::swap(
other.size, size);
328 std::swap(
other.length, length);
329 std::swap(
other.digit, digit);
330 std::swap(
other.positive, positive);
336 void setPower2(
unsigned exponent);
343 return BigInt(lhs) += rhs;
347 return BigInt(lhs) -= rhs;
351 return BigInt(lhs) *= rhs;
355 return BigInt(lhs) /= rhs;
359 return BigInt(lhs) %= rhs;
366#define BINARY_ARITHMETIC_OPERATORS(OTHER) \
367 inline BigInt operator+(const BigInt &lhs, OTHER rhs) \
369 return BigInt(lhs) += rhs; \
371 inline BigInt operator+(OTHER lhs, const BigInt &rhs) \
373 return BigInt(rhs) += lhs; \
375 inline BigInt operator*(const BigInt &lhs, OTHER rhs) \
377 return BigInt(lhs) *= rhs; \
379 inline BigInt operator*(OTHER lhs, const BigInt &rhs) \
381 return BigInt(rhs) *= lhs; \
383 inline BigInt operator-(const BigInt &lhs, OTHER rhs) \
385 return BigInt(lhs) -= rhs; \
387 inline BigInt operator/(const BigInt &lhs, OTHER rhs) \
389 return BigInt(lhs) /= rhs; \
391 inline BigInt operator%(const BigInt &lhs, OTHER rhs) \
393 return BigInt(lhs) %= rhs; \
402#undef BINARY_ARITHMETIC_OPERATORS
433#define COMPARISON_OPERATORS(OTHER) \
434 inline bool operator<(const BigInt &lhs, OTHER rhs) \
436 return lhs.compare(rhs) < 0; \
438 inline bool operator>(const BigInt &lhs, OTHER rhs) \
440 return lhs.compare(rhs) > 0; \
442 inline bool operator<=(const BigInt &lhs, OTHER rhs) \
444 return lhs.compare(rhs) <= 0; \
446 inline bool operator>=(const BigInt &lhs, OTHER rhs) \
448 return lhs.compare(rhs) >= 0; \
450 inline bool operator==(const BigInt &lhs, OTHER rhs) \
452 return lhs.compare(rhs) == 0; \
454 inline bool operator!=(const BigInt &lhs, OTHER rhs) \
456 return lhs.compare(rhs) != 0; \
458 inline bool operator<(OTHER lhs, const BigInt &rhs) \
460 return -rhs.compare(lhs) < 0; \
462 inline bool operator>(OTHER lhs, const BigInt &rhs) \
464 return -rhs.compare(lhs) > 0; \
466 inline bool operator<=(OTHER lhs, const BigInt &rhs) \
468 return -rhs.compare(lhs) <= 0; \
470 inline bool operator>=(OTHER lhs, const BigInt &rhs) \
472 return -rhs.compare(lhs) >= 0; \
474 inline bool operator==(OTHER lhs, const BigInt &rhs) \
476 return -rhs.compare(lhs) == 0; \
478 inline bool operator!=(OTHER lhs, const BigInt &rhs) \
480 return -rhs.compare(lhs) != 0; \
489#undef COMPARISON_OPERATORS
BigInt::onedig_t onedig_t
Definition bigint.cpp:23
BigInt::llong_t llong_t
Definition bigint.cpp:21
BigInt::ullong_t ullong_t
Definition bigint.cpp:22
BigInt operator+(const BigInt &lhs, const BigInt &rhs)
Definition bigint.hh:341
BigInt operator*(const BigInt &lhs, const BigInt &rhs)
Definition bigint.hh:349
bool operator<(const BigInt &lhs, const BigInt &rhs)
Definition bigint.hh:406
bool operator>(const BigInt &lhs, const BigInt &rhs)
Definition bigint.hh:410
BigInt operator-(const BigInt &lhs, const BigInt &rhs)
Definition bigint.hh:345
#define BINARY_ARITHMETIC_OPERATORS(OTHER)
Definition bigint.hh:366
#define OVERLOAD_IN_PLACE_OPERATOR(FROM, TO)
Definition bigint.hh:266
bool operator!=(const BigInt &lhs, const BigInt &rhs)
Definition bigint.hh:426
bool operator<=(const BigInt &lhs, const BigInt &rhs)
Definition bigint.hh:414
#define COMPARISON_OPERATORS(OTHER)
Definition bigint.hh:433
#define IN_PLACE_OPERATOR(TYPE)
Definition bigint.hh:254
BigInt operator%(const BigInt &lhs, const BigInt &rhs)
Definition bigint.hh:357
bool operator==(const BigInt &lhs, const BigInt &rhs)
Definition bigint.hh:422
BigInt operator/(const BigInt &lhs, const BigInt &rhs)
Definition bigint.hh:353
bool operator>=(const BigInt &lhs, const BigInt &rhs)
Definition bigint.hh:418
bool is_uint64() const
Definition bigint.hh:175
void load(unsigned char const *, unsigned)
Definition bigint.cpp:605
BigInt & operator++()
Definition bigint.hh:294
int64_t to_int64() const
Definition bigint.cpp:670
long llong_t
Definition bigint.hh:92
int compare(unsigned long n) const
Definition bigint.hh:203
unsigned digits(onedig_t=10) const
Definition bigint.cpp:514
~BigInt()
Definition bigint.cpp:367
int compare(unsigned n) const
Definition bigint.hh:211
BigInt & operator=(BigInt const &)
Definition bigint.cpp:448
bool is_odd() const
Definition bigint.hh:230
bool dump(unsigned char *, unsigned) const
Definition bigint.cpp:560
char const * scan_on(char const *, onedig_t=10)
Definition bigint.cpp:461
int compare(long n) const
Definition bigint.hh:199
static BigInt power2(unsigned n)
Definition bigint.hh:310
bool is_int64() const
Definition bigint.cpp:635
bool is_even() const
Definition bigint.hh:234
unsigned short onedig_t
Definition bigint.hh:76
int compare(llong_t) const
Definition bigint.cpp:709
bool is_zero() const
Definition bigint.hh:218
int compare(int n) const
Definition bigint.hh:207
void swap(BigInt &other)
Definition bigint.hh:325
@ small
Definition bigint.hh:100
friend BigInt operator-(BigInt b)
Definition bigint.hh:248
char * as_string(char *, unsigned, onedig_t=10) const
Definition bigint.cpp:522
bool is_negative() const
Definition bigint.hh:226
static BigInt power2m1(unsigned n)
Definition bigint.hh:318
unsigned floorPow2() const
Definition bigint.cpp:1194
BigInt & negate()
Definition bigint.hh:241
BigInt(long unsigned int x)
bool is_positive() const
Definition bigint.hh:222
BigInt(long signed int x)
uint64_t to_uint64() const
Definition bigint.cpp:659
char const * scan(char const *, onedig_t=10)
Definition bigint.cpp:505
static void div(BigInt const &, BigInt const &, BigInt ", BigInt &rem)
Definition bigint.cpp:957
BigInt & operator--()
Definition bigint.hh:298
unsigned long ullong_t
Definition bigint.hh:93
BigInt()
Definition bigint.cpp:381
unsigned twodig_t
Definition bigint.hh:77
@ other
Definition converter_compare.cpp:887
guard2tc & operator-=(guard2tc &g1, const guard2tc &g2)
Definition irep2_guard.cpp:334
void add(int64_t *A, int64_t *B, int64_t *C, int64_t a_rows, int64_t a_cols, int64_t b_rows, int64_t b_cols)
Definition umath.c:23