#include <biginteger.h>
Definition at line 28 of file biginteger.h.
internal::BigInteger::BigInteger |
( |
const BigInteger & |
rhs | ) |
|
|
inline |
internal::BigInteger::BigInteger |
( |
uint64_t |
u | ) |
|
|
inlineexplicit |
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) {
47 length -= kMaxDigitPerIteration;
48 i += kMaxDigitPerIteration;
#define RAPIDJSON_ASSERT(x)
Assertion.
void AppendDecimal64(const char *begin, const char *end)
void internal::BigInteger::AppendDecimal64 |
( |
const char * |
begin, |
|
|
const char * |
end |
|
) |
| |
|
inlineprivate |
Definition at line 224 of file biginteger.h.
229 unsigned exp =
static_cast<unsigned>(
end -
begin);
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
static uint64_t ParseUint64(const char *begin, const char *end)
unsigned __int64 uint64_t
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
BigInteger & MultiplyPow5(unsigned exp)
int internal::BigInteger::Compare |
( |
const BigInteger & |
rhs | ) |
const |
|
inline |
Definition at line 208 of file biginteger.h.
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;
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;
#define RAPIDJSON_ASSERT(x)
Assertion.
int Compare(const BigInteger &rhs) const
BigInteger(const BigInteger &rhs)
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
size_t internal::BigInteger::GetCount |
( |
| ) |
const |
|
inline |
Type internal::BigInteger::GetDigit |
( |
size_t |
index | ) |
const |
|
inline |
Definition at line 220 of file biginteger.h.
#define RAPIDJSON_ASSERT(x)
Assertion.
bool internal::BigInteger::IsZero |
( |
| ) |
const |
|
inline |
Definition at line 249 of file biginteger.h.
250 #if defined(_MSC_VER) && defined(_M_AMD64) 255 #elif (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) && defined(__x86_64__) 256 __extension__
typedef unsigned __int128 uint128;
257 uint128
p =
static_cast<uint128
>(
a) * static_cast<uint128>(
b);
259 *outHigh =
static_cast<uint64_t>(p >> 64);
262 const uint64_t a0 =
a & 0xFFFFFFFF,
a1 =
a >> 32, b0 =
b & 0xFFFFFFFF, b1 =
b >> 32;
263 uint64_t x0 = a0 * b0, x1 = a0 * b1, x2 = a1 * b0, x3 = a1 * b1;
267 x3 += (
static_cast<uint64_t>(1) << 32);
268 uint64_t lo = (x1 << 32) + (x0 & 0xFFFFFFFF);
unsigned __int64 uint64_t
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
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.
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++) {
void PushBack(Type digit)
static uint64_t MulAdd64(uint64_t a, uint64_t b, uint64_t k, uint64_t *outHigh)
unsigned __int64 uint64_t
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++) {
117 const uint64_t p1 = uc + (p0 >> 32);
118 digits_[i] = (p0 & 0xFFFFFFFF) | (p1 << 32);
void PushBack(Type digit)
unsigned __int64 uint64_t
Definition at line 70 of file biginteger.h.
73 for (
size_t i = 0; i <
count_ - 1; i++) {
81 if (
digits_[count_ - 1] < backup)
void PushBack(Type digit)
BigInteger& internal::BigInteger::operator<<= |
( |
size_t |
shift | ) |
|
|
inline |
Definition at line 128 of file biginteger.h.
129 if (
IsZero() || shift == 0)
return *
this;
132 size_t interShift = shift %
kTypeBit;
135 if (interShift == 0) {
141 for (
size_t i =
count_; i > 0; i--)
static const size_t kCapacity
#define RAPIDJSON_ASSERT(x)
Assertion.
static const size_t kTypeBit
bool internal::BigInteger::operator== |
( |
const Type |
rhs | ) |
const |
|
inline |
static uint64_t internal::BigInteger::ParseUint64 |
( |
const char * |
begin, |
|
|
const char * |
end |
|
) |
| |
|
inlinestaticprivate |
Definition at line 239 of file biginteger.h.
243 r = r * 10u +
static_cast<unsigned>(*
p -
'0');
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
#define RAPIDJSON_ASSERT(x)
Assertion.
unsigned __int64 uint64_t
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
void internal::BigInteger::PushBack |
( |
Type |
digit | ) |
|
|
inlineprivate |
Definition at line 234 of file biginteger.h.
static const size_t kCapacity
#define RAPIDJSON_ASSERT(x)
Assertion.
size_t internal::BigInteger::count_ |
|
private |
const size_t internal::BigInteger::kBitCount = 3328 |
|
staticprivate |
const size_t internal::BigInteger::kCapacity = kBitCount / sizeof(Type) |
|
staticprivate |
const size_t internal::BigInteger::kTypeBit = sizeof(Type) * 8 |
|
staticprivate |
The documentation for this class was generated from the following file: