42#ifndef TEUCHOS_BIG_UINT_HPP
43#define TEUCHOS_BIG_UINT_HPP
59 for (
int i = 2;
i < n; ++
i) x[
i] = 0;
60 if (n > 1) x[1] = std::uint32_t(
v >> 32);
61 x[0] = std::uint32_t(
v);
74 for (
int i = 0;
i < n; ++
i)
if (x[
i])
return true;
87 for (
int i = 0;
i < n; ++
i) {
88 std::uint64_t
ax = x[
i];
90 carry = std::uint32_t(
cx >> 32);
91 x[
i] = std::uint32_t(
cx);
98 std::uint32_t
carry = 0;
99 for (
int i = 0;
i < n; ++
i) {
100 std::uint64_t
ax = x[
i];
101 std::uint64_t
bx =
b[
i];
103 carry = std::uint32_t(
cx >> 32);
104 x[
i] = std::uint32_t(
cx);
112 for (
int i = 0;
i < n; ++
i) {
113 std::int64_t
ax = x[
i];
117 cx += std::int64_t(1) << 32;
121 x[
i] = std::uint32_t(
cx);
128 std::int64_t
carry = 0;
129 for (
int i = 0;
i < n; ++
i) {
130 std::int64_t
ax = x[
i];
131 std::int64_t
bx =
b[
i];
135 cx += std::int64_t(1) << 32;
139 x[
i] = std::uint32_t(
cx);
146 std::uint32_t
carry = 0;
147 for (
int i = 0;
i < n; ++
i) {
148 std::uint64_t
ax = x[
i];
149 auto cx = (
ax * std::uint64_t(
b)) + std::uint64_t(
carry);
150 carry = std::uint32_t(
cx >> 32);
151 x[
i] = std::uint32_t(
cx);
160 for (
int i = n - 1;
i >= 0; --
i) {
161 std::uint32_t
xi = 0;
178 for (
int i = 0;
i < n; ++
i) {
179 std::uint32_t
xi = 0;
198 for (
int j = 0;
j <
i / 2; ++
j) {
203 if (
i == 0)
buf[
i++] =
'0';
227 for (
int i = n - 1;
i >= 0; --
i) {
276 for (
int i = n - 1;
i >= 0; --
i) {
278 if (
a[
i] >
b[
i])
return 1;
307 for (
int i = 0;
i < n; ++
i)
if (
a[
i] !=
b[
i])
return false;
314 for (
int i = n - 1;
i >= 0;) {
Arbitrary-precision unsigned integer declaration.
Arbitrary-precision unsigned integer class.
BigUInt & operator-=(std::uint32_t b)
BigUInt & operator+=(std::uint32_t b)
BigUInt & operator>>=(std::uint32_t b)
std::uint32_t & operator[](int i)
BigUInt & operator*=(std::uint32_t b)
BigUInt & operator<<=(std::uint32_t b)
Concrete serial communicator subclass.
void divmod(BigUInt< n > "ient, BigUInt< n > &x, std::uint32_t const &b)
BigUInt< n > operator+(BigUInt< n > const &a, BigUInt< n > const &b)
bool operator>=(BigUInt< n > const &a, BigUInt< n > const &b)
std::ostream & operator<<(std::ostream &os, BigUInt< n > a)
int comp(BigUInt< n > const &a, BigUInt< n > const &b)
bool operator<(BigUInt< n > const &a, BigUInt< n > const &b)
BigUInt< n > operator-(BigUInt< n > const &a, BigUInt< n > const &b)
bool operator<=(BigUInt< n > const &a, BigUInt< n > const &b)
BigUInt< n > operator*(BigUInt< n > const &a, BigUInt< n > const &b)
BigUInt< n > operator/(BigUInt< n > const &a, std::uint32_t const &b)
bool operator==(BigUInt< n > const &a, BigUInt< n > const &b)
bool operator>(BigUInt< n > const &a, BigUInt< n > const &b)