#include <biginteger.h>
Definition at line 28 of file biginteger.h.
◆ Type
◆ BigInteger() [1/3]
| internal::BigInteger::BigInteger |
( |
const BigInteger & |
rhs | ) |
|
|
inline |
Definition at line 32 of file biginteger.h.
32 : count_(rhs.count_) {
void * memcpy(void *a, const void *b, size_t c)
◆ BigInteger() [2/3]
| internal::BigInteger::BigInteger |
( |
uint64_t |
u | ) |
|
|
inlineexplicit |
◆ BigInteger() [3/3]
| internal::BigInteger::BigInteger |
( |
const char * |
decimals, |
|
|
size_t |
length |
|
) |
| |
|
inline |
Definition at line 40 of file biginteger.h.
44 const size_t kMaxDigitPerIteration = 19;
45 while (length >= kMaxDigitPerIteration) {
46 AppendDecimal64(decimals + i, decimals + i + kMaxDigitPerIteration);
47 length -= kMaxDigitPerIteration;
48 i += kMaxDigitPerIteration;
52 AppendDecimal64(decimals + i, decimals + i + length);
#define RAPIDJSON_ASSERT(x)
Assertion.
◆ Compare()
| int internal::BigInteger::Compare |
( |
const BigInteger & |
rhs | ) |
const |
|
inline |
Definition at line 208 of file biginteger.h.
209 if (count_ != rhs.count_)
210 return count_ < rhs.count_ ? -1 : 1;
212 for (
size_t i = count_; i-- > 0;)
213 if (digits_[i] != rhs.digits_[i])
214 return digits_[i] < rhs.digits_[i] ? -1 : 1;
◆ Difference()
Definition at line 186 of file biginteger.h.
191 if (cmp < 0) {
a = &rhs; b =
this; ret =
true; }
192 else {
a =
this; b = &rhs; ret =
false; }
195 for (
size_t i = 0; i <
a->count_; i++) {
196 Type d =
a->digits_[i] - borrow;
199 borrow = (d >
a->digits_[i]) ? 1 : 0;
int Compare(const BigInteger &rhs) const
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
BigInteger(const BigInteger &rhs)
#define RAPIDJSON_ASSERT(x)
Assertion.
◆ GetCount()
| size_t internal::BigInteger::GetCount |
( |
| ) |
const |
|
inline |
◆ GetDigit()
| Type internal::BigInteger::GetDigit |
( |
size_t |
index | ) |
const |
|
inline |
Definition at line 220 of file biginteger.h.
#define RAPIDJSON_ASSERT(x)
Assertion.
◆ IsZero()
| bool internal::BigInteger::IsZero |
( |
| ) |
const |
|
inline |
Definition at line 221 of file biginteger.h.
221 {
return count_ == 1 && digits_[0] == 0; }
◆ MultiplyPow5()
| BigInteger& internal::BigInteger::MultiplyPow5 |
( |
unsigned |
exp | ) |
|
|
inline |
Definition at line 162 of file biginteger.h.
169 5 * 5 * 5 * 5 * 5 * 5,
170 5 * 5 * 5 * 5 * 5 * 5 * 5,
171 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5,
172 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5,
173 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5,
174 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5,
175 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5
177 if (exp == 0)
return *
this;
179 for (; exp >= 13; exp -= 13) *
this *= static_cast<uint32_t>(1220703125u);
180 if (exp > 0) *
this *= kPow5[exp - 1];
#define RAPIDJSON_UINT64_C2(high32, low32)
Construct a 64-bit literal by a pair of 32-bit integer.
◆ operator*=() [1/2]
Definition at line 87 of file biginteger.h.
88 if (u == 0)
return *
this = 0;
89 if (u == 1)
return *
this;
90 if (*
this == 1)
return *
this = u;
93 for (
size_t i = 0; i < count_; i++) {
95 digits_[i] = MulAdd64(digits_[i], u, k, &hi);
unsigned __int64 uint64_t
◆ operator*=() [2/2]
Definition at line 105 of file biginteger.h.
106 if (u == 0)
return *
this = 0;
107 if (u == 1)
return *
this;
108 if (*
this == 1)
return *
this = u;
111 for (
size_t i = 0; i < count_; i++) {
112 const uint64_t c = digits_[i] >> 32;
113 const uint64_t d = digits_[i] & 0xFFFFFFFF;
117 const uint64_t p1 = uc + (p0 >> 32);
118 digits_[i] = (p0 & 0xFFFFFFFF) | (p1 << 32);
unsigned __int64 uint64_t
◆ operator+=()
Definition at line 70 of file biginteger.h.
71 Type backup = digits_[0];
73 for (
size_t i = 0; i < count_ - 1; i++) {
74 if (digits_[i] >= backup)
76 backup = digits_[i + 1];
81 if (digits_[count_ - 1] < backup)
◆ operator<<=()
| BigInteger& internal::BigInteger::operator<<= |
( |
size_t |
shift | ) |
|
|
inline |
Definition at line 128 of file biginteger.h.
129 if (
IsZero() || shift == 0)
return *
this;
131 size_t offset = shift / kTypeBit;
132 size_t interShift = shift % kTypeBit;
135 if (interShift == 0) {
141 for (
size_t i = count_; i > 0; i--)
142 digits_[i + offset] = (digits_[i] << interShift) | (digits_[i - 1] >> (kTypeBit - interShift));
143 digits_[offset] = digits_[0] << interShift;
149 std::memset(digits_, 0, offset *
sizeof(
Type));
void * memmove(void *a, const void *b, size_t c)
#define RAPIDJSON_ASSERT(x)
Assertion.
◆ operator=() [1/2]
Definition at line 55 of file biginteger.h.
void * memcpy(void *a, const void *b, size_t c)
◆ operator=() [2/2]
◆ operator==() [1/2]
Definition at line 154 of file biginteger.h.
155 return count_ == rhs.count_ && std::memcmp(digits_, rhs.digits_, count_ *
sizeof(
Type)) == 0;
◆ operator==() [2/2]
| bool internal::BigInteger::operator== |
( |
const Type |
rhs | ) |
const |
|
inline |
Definition at line 158 of file biginteger.h.
159 return count_ == 1 && digits_[0] == rhs;
The documentation for this class was generated from the following file:
- /home/abuild/rpmbuild/BUILD/electroneum-5.0.0.4/external/rapidjson/include/rapidjson/internal/biginteger.h