#include <biginteger.h>
size_t count_
Definition: biginteger.h:274
Type digits_[kCapacity]
Definition: biginteger.h:273
Type
Type of JSON value.
Definition: rapidjson.h:642
internal::BigInteger::BigInteger |
( |
uint64_t |
u | ) |
|
|
inlineexplicit |
size_t count_
Definition: biginteger.h:274
Type digits_[kCapacity]
Definition: biginteger.h:273
internal::BigInteger::BigInteger |
( |
const char * |
decimals, |
|
|
size_t |
length |
|
) |
| |
|
inline |
43 const size_t kMaxDigitPerIteration = 19;
44 while (
length >= kMaxDigitPerIteration) {
46 length -= kMaxDigitPerIteration;
47 i += kMaxDigitPerIteration;
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:344
void AppendDecimal64(const char *begin, const char *end)
Definition: biginteger.h:214
size_t count_
Definition: biginteger.h:274
Type digits_[kCapacity]
Definition: biginteger.h:273
float length(float v)
Definition: vectorMath.h:208
void internal::BigInteger::AppendDecimal64 |
( |
const char * |
begin, |
|
|
const char * |
end |
|
) |
| |
|
inlineprivate |
219 unsigned exp =
static_cast<unsigned>(end - begin);
Quat exp(const Quat &q)
Definition: Quat.h:729
bool IsZero() const
Definition: biginteger.h:211
static uint64_t ParseUint64(const char *begin, const char *end)
Definition: biginteger.h:229
unsigned __int64 uint64_t
Definition: stdint.h:90
BigInteger & MultiplyPow5(unsigned exp)
Definition: biginteger.h:152
200 return count_ < rhs.count_ ? -1 : 1;
202 for (
size_t i =
count_; i-- > 0;)
203 if (
digits_[i] != rhs.digits_[i])
204 return digits_[i] < rhs.digits_[i] ? -1 : 1;
size_t count_
Definition: biginteger.h:274
Type digits_[kCapacity]
Definition: biginteger.h:273
181 if (cmp < 0) { a = &rhs; b =
this; ret =
true; }
182 else { a =
this; b = &rhs; ret =
false; }
185 for (
size_t i = 0; i < a->count_; i++) {
186 Type d = a->digits_[i] - borrow;
189 borrow = (d > a->digits_[i]) ? 1 : 0;
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:344
int Compare(const BigInteger &rhs) const
Definition: biginteger.h:198
BigInteger(const BigInteger &rhs)
Definition: biginteger.h:31
size_t count_
Definition: biginteger.h:274
Type
Type of JSON value.
Definition: rapidjson.h:642
size_t internal::BigInteger::GetCount |
( |
| ) |
const |
|
inline |
size_t count_
Definition: biginteger.h:274
Type internal::BigInteger::GetDigit |
( |
size_t |
index | ) |
const |
|
inline |
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:344
size_t count_
Definition: biginteger.h:274
Type digits_[kCapacity]
Definition: biginteger.h:273
bool internal::BigInteger::IsZero |
( |
| ) |
const |
|
inline |
size_t count_
Definition: biginteger.h:274
Type digits_[kCapacity]
Definition: biginteger.h:273
240 #if defined(_MSC_VER) && defined(_M_AMD64)
241 uint64_t low = _umul128(a, b, outHigh) + k;
245 #elif (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) && defined(__x86_64__)
246 __extension__
typedef unsigned __int128 uint128;
247 uint128 p =
static_cast<uint128
>(a) * static_cast<uint128>(b);
249 *outHigh =
static_cast<uint64_t>(p >> 64);
252 const uint64_t a0 = a & 0xFFFFFFFF, a1 = a >> 32, b0 = b & 0xFFFFFFFF, b1 = b >> 32;
253 uint64_t x0 = a0 * b0, x1 = a0 * b1, x2 = a1 * b0, x3 = a1 * b1;
257 x3 += (
static_cast<uint64_t>(1) << 32);
258 uint64_t lo = (x1 << 32) + (x0 & 0xFFFFFFFF);
unsigned __int64 uint64_t
Definition: stdint.h:90
BigInteger& internal::BigInteger::MultiplyPow5 |
( |
unsigned |
exp | ) |
|
|
inline |
159 5 * 5 * 5 * 5 * 5 * 5,
160 5 * 5 * 5 * 5 * 5 * 5 * 5,
161 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5,
162 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5,
163 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5,
164 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5,
165 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5
167 if (
exp == 0)
return *
this;
169 for (;
exp >= 13;
exp -= 13) *
this *= static_cast<uint32_t>(1220703125u);
170 if (
exp > 0) *
this *= kPow5[
exp - 1];
Quat exp(const Quat &q)
Definition: Quat.h:729
#define RAPIDJSON_UINT64_C2(high32, low32)
Construct a 64-bit literal by a pair of 32-bit integer.
Definition: rapidjson.h:261
unsigned int uint32_t
Definition: stdint.h:80
78 if (u == 0)
return *
this = 0;
79 if (u == 1)
return *
this;
80 if (*
this == 1)
return *
this = u;
83 for (
size_t i = 0; i <
count_; i++) {
void PushBack(Type digit)
Definition: biginteger.h:224
static uint64_t MulAdd64(uint64_t a, uint64_t b, uint64_t k, uint64_t *outHigh)
Definition: biginteger.h:239
size_t count_
Definition: biginteger.h:274
unsigned __int64 uint64_t
Definition: stdint.h:90
Type digits_[kCapacity]
Definition: biginteger.h:273
96 if (u == 0)
return *
this = 0;
97 if (u == 1)
return *
this;
98 if (*
this == 1)
return *
this = u;
101 for (
size_t i = 0; i <
count_; i++) {
107 const uint64_t p1 = uc + (p0 >> 32);
108 digits_[i] = (p0 & 0xFFFFFFFF) | (p1 << 32);
void PushBack(Type digit)
Definition: biginteger.h:224
size_t count_
Definition: biginteger.h:274
unsigned __int64 uint64_t
Definition: stdint.h:90
Type digits_[kCapacity]
Definition: biginteger.h:273
63 for (
size_t i = 0; i <
count_ - 1; i++) {
71 if (
digits_[count_ - 1] < backup)
void PushBack(Type digit)
Definition: biginteger.h:224
size_t count_
Definition: biginteger.h:274
Type digits_[kCapacity]
Definition: biginteger.h:273
Type
Type of JSON value.
Definition: rapidjson.h:642
BigInteger& internal::BigInteger::operator<<= |
( |
size_t |
shift | ) |
|
|
inline |
119 if (
IsZero() || shift == 0)
return *
this;
122 size_t interShift = shift %
kTypeBit;
125 if (interShift == 0) {
131 for (
size_t i =
count_; i > 0; i--)
static const size_t kCapacity
Definition: biginteger.h:270
bool IsZero() const
Definition: biginteger.h:211
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:344
size_t count_
Definition: biginteger.h:274
Type digits_[kCapacity]
Definition: biginteger.h:273
static const size_t kTypeBit
Definition: biginteger.h:271
Type
Type of JSON value.
Definition: rapidjson.h:642
size_t count_
Definition: biginteger.h:274
Type digits_[kCapacity]
Definition: biginteger.h:273
size_t count_
Definition: biginteger.h:274
Type digits_[kCapacity]
Definition: biginteger.h:273
Type
Type of JSON value.
Definition: rapidjson.h:642
size_t count_
Definition: biginteger.h:274
Type digits_[kCapacity]
Definition: biginteger.h:273
static uint64_t internal::BigInteger::ParseUint64 |
( |
const char * |
begin, |
|
|
const char * |
end |
|
) |
| |
|
inlinestaticprivate |
231 for (
const char* p = begin; p != end; ++p) {
233 r = r * 10 + (*p -
'0');
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:344
unsigned __int64 uint64_t
Definition: stdint.h:90
void internal::BigInteger::PushBack |
( |
Type |
digit | ) |
|
|
inlineprivate |
static const size_t kCapacity
Definition: biginteger.h:270
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:344
size_t count_
Definition: biginteger.h:274
Type digits_[kCapacity]
Definition: biginteger.h:273
size_t internal::BigInteger::count_ |
|
private |
const size_t internal::BigInteger::kBitCount = 3328 |
|
staticprivate |
const size_t internal::BigInteger::kTypeBit = sizeof(Type) * 8 |
|
staticprivate |
The documentation for this class was generated from the following file: