Classes | Typedefs | Functions | Variables
internal Namespace Reference

Classes

class  BigInteger
 
class  DecodedStream
 
struct  DiyFp
 
class  Double
 
class  GenericRegex
 Regular expression engine with subset of ECMAscript grammar. More...
 
class  GenericRegexSearch
 
class  Hasher
 
class  ISchemaStateFactory
 
class  ISchemaValidator
 
struct  IsGenericValue
 
struct  IsGenericValueImpl
 
struct  IsGenericValueImpl< T, typename Void< typename T::EncodingType >::Type, typename Void< typename T::AllocatorType >::Type >
 
class  IValidationErrorHandler
 
class  Schema
 
struct  SchemaValidationContext
 
class  Stack
 A type-unsafe stack for storing different types of data. More...
 
class  StreamLocalCopy
 
class  StreamLocalCopy< Stream, 0 >
 Keep reference. More...
 
class  StreamLocalCopy< Stream, 1 >
 Do copy optimization. More...
 
struct  TokenHelper
 
struct  TokenHelper< Stack, char >
 
struct  TypeHelper
 
struct  TypeHelper< ValueType, bool >
 
struct  TypeHelper< ValueType, const typename ValueType::Ch * >
 
struct  TypeHelper< ValueType, double >
 
struct  TypeHelper< ValueType, float >
 
struct  TypeHelper< ValueType, int >
 
struct  TypeHelper< ValueType, int64_t >
 
struct  TypeHelper< ValueType, typename ValueType::Array >
 
struct  TypeHelper< ValueType, typename ValueType::ConstArray >
 
struct  TypeHelper< ValueType, typename ValueType::ConstObject >
 
struct  TypeHelper< ValueType, typename ValueType::Object >
 
struct  TypeHelper< ValueType, uint64_t >
 
struct  TypeHelper< ValueType, unsigned >
 

Typedefs

typedef GenericRegex< UTF8<> > Regex
 
typedef GenericRegexSearch< RegexRegexSearch
 

Functions

DiyFp GetCachedPowerByIndex (size_t index)
 
DiyFp GetCachedPower (int e, int *K)
 
DiyFp GetCachedPower10 (int exp, int *outExp)
 
void GrisuRound (char *buffer, int len, uint64_t delta, uint64_t rest, uint64_t ten_kappa, uint64_t wp_w)
 
int CountDecimalDigit32 (uint32_t n)
 
void DigitGen (const DiyFp &W, const DiyFp &Mp, uint64_t delta, char *buffer, int *len, int *K)
 
void Grisu2 (double value, char *buffer, int *length, int *K)
 
char * WriteExponent (int K, char *buffer)
 
char * Prettify (char *buffer, int length, int k, int maxDecimalPlaces)
 
char * dtoa (double value, char *buffer, int maxDecimalPlaces=324)
 
const char * GetDigitsLut ()
 
char * u32toa (uint32_t value, char *buffer)
 
char * i32toa (int32_t value, char *buffer)
 
char * u64toa (uint64_t value, char *buffer)
 
char * i64toa (int64_t value, char *buffer)
 
double Pow10 (int n)
 Computes integer powers of 10 in double (10.0^n). More...
 
template<typename Ch >
SizeType StrLen (const Ch *s)
 Custom strlen() which works on different character types. More...
 
template<>
SizeType StrLen (const char *s)
 
template<>
SizeType StrLen (const wchar_t *s)
 
template<typename Encoding >
bool CountStringCodePoint (const typename Encoding::Ch *s, SizeType length, SizeType *outCount)
 Returns number of code points in a encoded string. More...
 
double FastPath (double significand, int exp)
 
double StrtodNormalPrecision (double d, int p)
 
template<typename T >
Min3 (T a, T b, T c)
 
int CheckWithinHalfULP (double b, const BigInteger &d, int dExp)
 
bool StrtodFast (double d, int p, double *result)
 
bool StrtodDiyFp (const char *decimals, int dLen, int dExp, double *result)
 
double StrtodBigInteger (double approx, const char *decimals, int dLen, int dExp)
 
double StrtodFullPrecision (double d, int p, const char *decimals, size_t length, size_t decimalPosition, int exp)
 
template<typename T >
void Swap (T &a, T &b) RAPIDJSON_NOEXCEPT
 Custom swap() to avoid dependency on C++ <algorithm> header. More...
 

Variables

static const SizeType kRegexInvalidState = ~SizeType(0)
 Represents an invalid index in GenericRegex::State::out, out1. More...
 
static const SizeType kRegexInvalidRange = ~SizeType(0)
 

Typedef Documentation

Definition at line 718 of file regex.h.

Definition at line 719 of file regex.h.

Function Documentation

int internal::CheckWithinHalfULP ( double  b,
const BigInteger d,
int  dExp 
)
inline

Definition at line 56 of file strtod.h.

56  {
57  const Double db(b);
58  const uint64_t bInt = db.IntegerSignificand();
59  const int bExp = db.IntegerExponent();
60  const int hExp = bExp - 1;
61 
62  int dS_Exp2 = 0, dS_Exp5 = 0, bS_Exp2 = 0, bS_Exp5 = 0, hS_Exp2 = 0, hS_Exp5 = 0;
63 
64  // Adjust for decimal exponent
65  if (dExp >= 0) {
66  dS_Exp2 += dExp;
67  dS_Exp5 += dExp;
68  }
69  else {
70  bS_Exp2 -= dExp;
71  bS_Exp5 -= dExp;
72  hS_Exp2 -= dExp;
73  hS_Exp5 -= dExp;
74  }
75 
76  // Adjust for binary exponent
77  if (bExp >= 0)
78  bS_Exp2 += bExp;
79  else {
80  dS_Exp2 -= bExp;
81  hS_Exp2 -= bExp;
82  }
83 
84  // Adjust for half ulp exponent
85  if (hExp >= 0)
86  hS_Exp2 += hExp;
87  else {
88  dS_Exp2 -= hExp;
89  bS_Exp2 -= hExp;
90  }
91 
92  // Remove common power of two factor from all three scaled values
93  int common_Exp2 = Min3(dS_Exp2, bS_Exp2, hS_Exp2);
94  dS_Exp2 -= common_Exp2;
95  bS_Exp2 -= common_Exp2;
96  hS_Exp2 -= common_Exp2;
97 
98  BigInteger dS = d;
99  dS.MultiplyPow5(static_cast<unsigned>(dS_Exp5)) <<= static_cast<unsigned>(dS_Exp2);
100 
101  BigInteger bS(bInt);
102  bS.MultiplyPow5(static_cast<unsigned>(bS_Exp5)) <<= static_cast<unsigned>(bS_Exp2);
103 
104  BigInteger hS(1);
105  hS.MultiplyPow5(static_cast<unsigned>(hS_Exp5)) <<= static_cast<unsigned>(hS_Exp2);
106 
107  BigInteger delta(0);
108  dS.Difference(bS, &delta);
109 
110  return delta.Compare(hS);
111 }
unsigned __int64 uint64_t
Definition: stdint.h:136
T Min3(T a, T b, T c)
Definition: strtod.h:49
static bool * b
Definition: config.cpp:1043
int internal::CountDecimalDigit32 ( uint32_t  n)
inline

Definition at line 44 of file dtoa.h.

44  {
45  // Simple pure C++ implementation was faster than __builtin_clz version in this situation.
46  if (n < 10) return 1;
47  if (n < 100) return 2;
48  if (n < 1000) return 3;
49  if (n < 10000) return 4;
50  if (n < 100000) return 5;
51  if (n < 1000000) return 6;
52  if (n < 10000000) return 7;
53  if (n < 100000000) return 8;
54  // Will not reach 10 digits in DigitGen()
55  //if (n < 1000000000) return 9;
56  //return 10;
57  return 9;
58 }
std::void_t< T > n
template<typename Encoding >
bool internal::CountStringCodePoint ( const typename Encoding::Ch *  s,
SizeType  length,
SizeType outCount 
)

Returns number of code points in a encoded string.

Definition at line 50 of file strfunc.h.

50  {
51  RAPIDJSON_ASSERT(s != 0);
52  RAPIDJSON_ASSERT(outCount != 0);
54  const typename Encoding::Ch* end = s + length;
55  SizeType count = 0;
56  while (is.src_ < end) {
57  unsigned codepoint;
58  if (!Encoding::Decode(is, &codepoint))
59  return false;
60  count++;
61  }
62  *outCount = count;
63  return true;
64 }
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
RAPIDJSON_NAMESPACE_BEGIN typedef unsigned SizeType
Size type (for string lengths, array sizes, etc.)
Definition: rapidjson.h:384
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:406
Read-only string stream.
Definition: fwd.h:47
static QCString * s
Definition: config.cpp:1042
void internal::DigitGen ( const DiyFp W,
const DiyFp Mp,
uint64_t  delta,
char *  buffer,
int *  len,
int *  K 
)
inline

Definition at line 60 of file dtoa.h.

60  {
61  static const uint32_t kPow10[] = { 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000 };
62  const DiyFp one(uint64_t(1) << -Mp.e, Mp.e);
63  const DiyFp wp_w = Mp - W;
64  uint32_t p1 = static_cast<uint32_t>(Mp.f >> -one.e);
65  uint64_t p2 = Mp.f & (one.f - 1);
66  int kappa = CountDecimalDigit32(p1); // kappa in [0, 9]
67  *len = 0;
68 
69  while (kappa > 0) {
70  uint32_t d = 0;
71  switch (kappa) {
72  case 9: d = p1 / 100000000; p1 %= 100000000; break;
73  case 8: d = p1 / 10000000; p1 %= 10000000; break;
74  case 7: d = p1 / 1000000; p1 %= 1000000; break;
75  case 6: d = p1 / 100000; p1 %= 100000; break;
76  case 5: d = p1 / 10000; p1 %= 10000; break;
77  case 4: d = p1 / 1000; p1 %= 1000; break;
78  case 3: d = p1 / 100; p1 %= 100; break;
79  case 2: d = p1 / 10; p1 %= 10; break;
80  case 1: d = p1; p1 = 0; break;
81  default:;
82  }
83  if (d || *len)
84  buffer[(*len)++] = static_cast<char>('0' + static_cast<char>(d));
85  kappa--;
86  uint64_t tmp = (static_cast<uint64_t>(p1) << -one.e) + p2;
87  if (tmp <= delta) {
88  *K += kappa;
89  GrisuRound(buffer, *len, delta, tmp, static_cast<uint64_t>(kPow10[kappa]) << -one.e, wp_w.f);
90  return;
91  }
92  }
93 
94  // kappa = 0
95  for (;;) {
96  p2 *= 10;
97  delta *= 10;
98  char d = static_cast<char>(p2 >> -one.e);
99  if (d || *len)
100  buffer[(*len)++] = static_cast<char>('0' + d);
101  p2 &= one.f - 1;
102  kappa--;
103  if (p2 < delta) {
104  *K += kappa;
105  int index = -kappa;
106  GrisuRound(buffer, *len, delta, p2, one.f, wp_w.f * (index < 9 ? kPow10[index] : 0));
107  return;
108  }
109  }
110 }
unsigned int uint32_t
Definition: stdint.h:126
void GrisuRound(char *buffer, int len, uint64_t delta, uint64_t rest, uint64_t ten_kappa, uint64_t wp_w)
Definition: dtoa.h:35
unsigned __int64 uint64_t
Definition: stdint.h:136
string tmp
Definition: languages.py:63
int CountDecimalDigit32(uint32_t n)
Definition: dtoa.h:44
char* internal::dtoa ( double  value,
char *  buffer,
int  maxDecimalPlaces = 324 
)
inline

Definition at line 216 of file dtoa.h.

216  {
217  RAPIDJSON_ASSERT(maxDecimalPlaces >= 1);
218  Double d(value);
219  if (d.IsZero()) {
220  if (d.Sign())
221  *buffer++ = '-'; // -0.0, Issue #289
222  buffer[0] = '0';
223  buffer[1] = '.';
224  buffer[2] = '0';
225  return &buffer[3];
226  }
227  else {
228  if (value < 0) {
229  *buffer++ = '-';
230  value = -value;
231  }
232  int length, K;
233  Grisu2(value, buffer, &length, &K);
234  return Prettify(buffer, length, K, maxDecimalPlaces);
235  }
236 }
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:406
char * Prettify(char *buffer, int length, int k, int maxDecimalPlaces)
Definition: dtoa.h:150
void Grisu2(double value, char *buffer, int *length, int *K)
Definition: dtoa.h:112
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1225
double internal::FastPath ( double  significand,
int  exp 
)
inline

Definition at line 28 of file strtod.h.

28  {
29  if (exp < -308)
30  return 0.0;
31  else if (exp >= 0)
32  return significand * internal::Pow10(exp);
33  else
34  return significand / internal::Pow10(-exp);
35 }
double Pow10(int n)
Computes integer powers of 10 in double (10.0^n).
Definition: pow10.h:28
DiyFp internal::GetCachedPower ( int  e,
int *  K 
)
inline

Definition at line 238 of file diyfp.h.

238  {
239 
240  //int k = static_cast<int>(ceil((-61 - e) * 0.30102999566398114)) + 374;
241  double dk = (-61 - e) * 0.30102999566398114 + 347; // dk must be positive, so can do ceiling in positive
242  int k = static_cast<int>(dk);
243  if (dk - k > 0.0)
244  k++;
245 
246  unsigned index = static_cast<unsigned>((k >> 3) + 1);
247  *K = -(-348 + static_cast<int>(index << 3)); // decimal exponent no need lookup table
248 
249  return GetCachedPowerByIndex(index);
250 }
const double e
DiyFp GetCachedPowerByIndex(size_t index)
Definition: diyfp.h:175
DiyFp internal::GetCachedPower10 ( int  exp,
int *  outExp 
)
inline

Definition at line 252 of file diyfp.h.

252  {
253  RAPIDJSON_ASSERT(exp >= -348);
254  unsigned index = static_cast<unsigned>(exp + 348) / 8u;
255  *outExp = -348 + static_cast<int>(index) * 8;
256  return GetCachedPowerByIndex(index);
257 }
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:406
DiyFp GetCachedPowerByIndex(size_t index)
Definition: diyfp.h:175
DiyFp internal::GetCachedPowerByIndex ( size_t  index)
inline

Definition at line 175 of file diyfp.h.

175  {
176  // 10^-348, 10^-340, ..., 10^340
177  static const uint64_t kCachedPowers_F[] = {
178  RAPIDJSON_UINT64_C2(0xfa8fd5a0, 0x081c0288), RAPIDJSON_UINT64_C2(0xbaaee17f, 0xa23ebf76),
179  RAPIDJSON_UINT64_C2(0x8b16fb20, 0x3055ac76), RAPIDJSON_UINT64_C2(0xcf42894a, 0x5dce35ea),
180  RAPIDJSON_UINT64_C2(0x9a6bb0aa, 0x55653b2d), RAPIDJSON_UINT64_C2(0xe61acf03, 0x3d1a45df),
181  RAPIDJSON_UINT64_C2(0xab70fe17, 0xc79ac6ca), RAPIDJSON_UINT64_C2(0xff77b1fc, 0xbebcdc4f),
182  RAPIDJSON_UINT64_C2(0xbe5691ef, 0x416bd60c), RAPIDJSON_UINT64_C2(0x8dd01fad, 0x907ffc3c),
183  RAPIDJSON_UINT64_C2(0xd3515c28, 0x31559a83), RAPIDJSON_UINT64_C2(0x9d71ac8f, 0xada6c9b5),
184  RAPIDJSON_UINT64_C2(0xea9c2277, 0x23ee8bcb), RAPIDJSON_UINT64_C2(0xaecc4991, 0x4078536d),
185  RAPIDJSON_UINT64_C2(0x823c1279, 0x5db6ce57), RAPIDJSON_UINT64_C2(0xc2109436, 0x4dfb5637),
186  RAPIDJSON_UINT64_C2(0x9096ea6f, 0x3848984f), RAPIDJSON_UINT64_C2(0xd77485cb, 0x25823ac7),
187  RAPIDJSON_UINT64_C2(0xa086cfcd, 0x97bf97f4), RAPIDJSON_UINT64_C2(0xef340a98, 0x172aace5),
188  RAPIDJSON_UINT64_C2(0xb23867fb, 0x2a35b28e), RAPIDJSON_UINT64_C2(0x84c8d4df, 0xd2c63f3b),
189  RAPIDJSON_UINT64_C2(0xc5dd4427, 0x1ad3cdba), RAPIDJSON_UINT64_C2(0x936b9fce, 0xbb25c996),
190  RAPIDJSON_UINT64_C2(0xdbac6c24, 0x7d62a584), RAPIDJSON_UINT64_C2(0xa3ab6658, 0x0d5fdaf6),
191  RAPIDJSON_UINT64_C2(0xf3e2f893, 0xdec3f126), RAPIDJSON_UINT64_C2(0xb5b5ada8, 0xaaff80b8),
192  RAPIDJSON_UINT64_C2(0x87625f05, 0x6c7c4a8b), RAPIDJSON_UINT64_C2(0xc9bcff60, 0x34c13053),
193  RAPIDJSON_UINT64_C2(0x964e858c, 0x91ba2655), RAPIDJSON_UINT64_C2(0xdff97724, 0x70297ebd),
194  RAPIDJSON_UINT64_C2(0xa6dfbd9f, 0xb8e5b88f), RAPIDJSON_UINT64_C2(0xf8a95fcf, 0x88747d94),
195  RAPIDJSON_UINT64_C2(0xb9447093, 0x8fa89bcf), RAPIDJSON_UINT64_C2(0x8a08f0f8, 0xbf0f156b),
196  RAPIDJSON_UINT64_C2(0xcdb02555, 0x653131b6), RAPIDJSON_UINT64_C2(0x993fe2c6, 0xd07b7fac),
197  RAPIDJSON_UINT64_C2(0xe45c10c4, 0x2a2b3b06), RAPIDJSON_UINT64_C2(0xaa242499, 0x697392d3),
198  RAPIDJSON_UINT64_C2(0xfd87b5f2, 0x8300ca0e), RAPIDJSON_UINT64_C2(0xbce50864, 0x92111aeb),
199  RAPIDJSON_UINT64_C2(0x8cbccc09, 0x6f5088cc), RAPIDJSON_UINT64_C2(0xd1b71758, 0xe219652c),
200  RAPIDJSON_UINT64_C2(0x9c400000, 0x00000000), RAPIDJSON_UINT64_C2(0xe8d4a510, 0x00000000),
201  RAPIDJSON_UINT64_C2(0xad78ebc5, 0xac620000), RAPIDJSON_UINT64_C2(0x813f3978, 0xf8940984),
202  RAPIDJSON_UINT64_C2(0xc097ce7b, 0xc90715b3), RAPIDJSON_UINT64_C2(0x8f7e32ce, 0x7bea5c70),
203  RAPIDJSON_UINT64_C2(0xd5d238a4, 0xabe98068), RAPIDJSON_UINT64_C2(0x9f4f2726, 0x179a2245),
204  RAPIDJSON_UINT64_C2(0xed63a231, 0xd4c4fb27), RAPIDJSON_UINT64_C2(0xb0de6538, 0x8cc8ada8),
205  RAPIDJSON_UINT64_C2(0x83c7088e, 0x1aab65db), RAPIDJSON_UINT64_C2(0xc45d1df9, 0x42711d9a),
206  RAPIDJSON_UINT64_C2(0x924d692c, 0xa61be758), RAPIDJSON_UINT64_C2(0xda01ee64, 0x1a708dea),
207  RAPIDJSON_UINT64_C2(0xa26da399, 0x9aef774a), RAPIDJSON_UINT64_C2(0xf209787b, 0xb47d6b85),
208  RAPIDJSON_UINT64_C2(0xb454e4a1, 0x79dd1877), RAPIDJSON_UINT64_C2(0x865b8692, 0x5b9bc5c2),
209  RAPIDJSON_UINT64_C2(0xc83553c5, 0xc8965d3d), RAPIDJSON_UINT64_C2(0x952ab45c, 0xfa97a0b3),
210  RAPIDJSON_UINT64_C2(0xde469fbd, 0x99a05fe3), RAPIDJSON_UINT64_C2(0xa59bc234, 0xdb398c25),
211  RAPIDJSON_UINT64_C2(0xf6c69a72, 0xa3989f5c), RAPIDJSON_UINT64_C2(0xb7dcbf53, 0x54e9bece),
212  RAPIDJSON_UINT64_C2(0x88fcf317, 0xf22241e2), RAPIDJSON_UINT64_C2(0xcc20ce9b, 0xd35c78a5),
213  RAPIDJSON_UINT64_C2(0x98165af3, 0x7b2153df), RAPIDJSON_UINT64_C2(0xe2a0b5dc, 0x971f303a),
214  RAPIDJSON_UINT64_C2(0xa8d9d153, 0x5ce3b396), RAPIDJSON_UINT64_C2(0xfb9b7cd9, 0xa4a7443c),
215  RAPIDJSON_UINT64_C2(0xbb764c4c, 0xa7a44410), RAPIDJSON_UINT64_C2(0x8bab8eef, 0xb6409c1a),
216  RAPIDJSON_UINT64_C2(0xd01fef10, 0xa657842c), RAPIDJSON_UINT64_C2(0x9b10a4e5, 0xe9913129),
217  RAPIDJSON_UINT64_C2(0xe7109bfb, 0xa19c0c9d), RAPIDJSON_UINT64_C2(0xac2820d9, 0x623bf429),
218  RAPIDJSON_UINT64_C2(0x80444b5e, 0x7aa7cf85), RAPIDJSON_UINT64_C2(0xbf21e440, 0x03acdd2d),
219  RAPIDJSON_UINT64_C2(0x8e679c2f, 0x5e44ff8f), RAPIDJSON_UINT64_C2(0xd433179d, 0x9c8cb841),
220  RAPIDJSON_UINT64_C2(0x9e19db92, 0xb4e31ba9), RAPIDJSON_UINT64_C2(0xeb96bf6e, 0xbadf77d9),
221  RAPIDJSON_UINT64_C2(0xaf87023b, 0x9bf0ee6b)
222  };
223  static const int16_t kCachedPowers_E[] = {
224  -1220, -1193, -1166, -1140, -1113, -1087, -1060, -1034, -1007, -980,
225  -954, -927, -901, -874, -847, -821, -794, -768, -741, -715,
226  -688, -661, -635, -608, -582, -555, -529, -502, -475, -449,
227  -422, -396, -369, -343, -316, -289, -263, -236, -210, -183,
228  -157, -130, -103, -77, -50, -24, 3, 30, 56, 83,
229  109, 136, 162, 189, 216, 242, 269, 295, 322, 348,
230  375, 402, 428, 455, 481, 508, 534, 561, 588, 614,
231  641, 667, 694, 720, 747, 774, 800, 827, 853, 880,
232  907, 933, 960, 986, 1013, 1039, 1066
233  };
234  RAPIDJSON_ASSERT(index < 87);
235  return DiyFp(kCachedPowers_F[index], kCachedPowers_E[index]);
236 }
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:406
#define RAPIDJSON_UINT64_C2(high32, low32)
Construct a 64-bit literal by a pair of 32-bit integer.
Definition: rapidjson.h:289
signed short int16_t
Definition: stdint.h:122
unsigned __int64 uint64_t
Definition: stdint.h:136
const char* internal::GetDigitsLut ( )
inline

Definition at line 23 of file itoa.h.

23  {
24  static const char cDigitsLut[200] = {
25  '0','0','0','1','0','2','0','3','0','4','0','5','0','6','0','7','0','8','0','9',
26  '1','0','1','1','1','2','1','3','1','4','1','5','1','6','1','7','1','8','1','9',
27  '2','0','2','1','2','2','2','3','2','4','2','5','2','6','2','7','2','8','2','9',
28  '3','0','3','1','3','2','3','3','3','4','3','5','3','6','3','7','3','8','3','9',
29  '4','0','4','1','4','2','4','3','4','4','4','5','4','6','4','7','4','8','4','9',
30  '5','0','5','1','5','2','5','3','5','4','5','5','5','6','5','7','5','8','5','9',
31  '6','0','6','1','6','2','6','3','6','4','6','5','6','6','6','7','6','8','6','9',
32  '7','0','7','1','7','2','7','3','7','4','7','5','7','6','7','7','7','8','7','9',
33  '8','0','8','1','8','2','8','3','8','4','8','5','8','6','8','7','8','8','8','9',
34  '9','0','9','1','9','2','9','3','9','4','9','5','9','6','9','7','9','8','9','9'
35  };
36  return cDigitsLut;
37 }
void internal::Grisu2 ( double  value,
char *  buffer,
int *  length,
int *  K 
)
inline

Definition at line 112 of file dtoa.h.

112  {
113  const DiyFp v(value);
114  DiyFp w_m, w_p;
115  v.NormalizedBoundaries(&w_m, &w_p);
116 
117  const DiyFp c_mk = GetCachedPower(w_p.e, K);
118  const DiyFp W = v.Normalize() * c_mk;
119  DiyFp Wp = w_p * c_mk;
120  DiyFp Wm = w_m * c_mk;
121  Wm.f++;
122  Wp.f--;
123  DigitGen(W, Wp, Wp.f - Wm.f, buffer, length, K);
124 }
void DigitGen(const DiyFp &W, const DiyFp &Mp, uint64_t delta, char *buffer, int *len, int *K)
Definition: dtoa.h:60
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1225
DiyFp GetCachedPower(int e, int *K)
Definition: diyfp.h:238
void internal::GrisuRound ( char *  buffer,
int  len,
uint64_t  delta,
uint64_t  rest,
uint64_t  ten_kappa,
uint64_t  wp_w 
)
inline

closer

Definition at line 35 of file dtoa.h.

35  {
36  while (rest < wp_w && delta - rest >= ten_kappa &&
37  (rest + ten_kappa < wp_w || /// closer
38  wp_w - rest > rest + ten_kappa - wp_w)) {
39  buffer[len - 1]--;
40  rest += ten_kappa;
41  }
42 }
char* internal::i32toa ( int32_t  value,
char *  buffer 
)
inline

Definition at line 115 of file itoa.h.

115  {
116  RAPIDJSON_ASSERT(buffer != 0);
117  uint32_t u = static_cast<uint32_t>(value);
118  if (value < 0) {
119  *buffer++ = '-';
120  u = ~u + 1;
121  }
122 
123  return u32toa(u, buffer);
124 }
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:406
unsigned int uint32_t
Definition: stdint.h:126
char * u32toa(uint32_t value, char *buffer)
Definition: itoa.h:39
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1225
char* internal::i64toa ( int64_t  value,
char *  buffer 
)
inline

Definition at line 294 of file itoa.h.

294  {
295  RAPIDJSON_ASSERT(buffer != 0);
296  uint64_t u = static_cast<uint64_t>(value);
297  if (value < 0) {
298  *buffer++ = '-';
299  u = ~u + 1;
300  }
301 
302  return u64toa(u, buffer);
303 }
char * u64toa(uint64_t value, char *buffer)
Definition: itoa.h:126
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:406
unsigned __int64 uint64_t
Definition: stdint.h:136
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1225
template<typename T >
T internal::Min3 ( a,
b,
c 
)
inline

Definition at line 49 of file strtod.h.

49  {
50  T m = a;
51  if (m > b) m = b;
52  if (m > c) m = c;
53  return m;
54 }
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition: pointer.h:1124
static bool * b
Definition: config.cpp:1043
double internal::Pow10 ( int  n)
inline

Computes integer powers of 10 in double (10.0^n).

This function uses lookup table for fast and accurate results.

Parameters
nnon-negative exponent. Must <= 308.
Returns
10.0^n

Definition at line 28 of file pow10.h.

28  {
29  static const double e[] = { // 1e-0...1e308: 309 * 8 bytes = 2472 bytes
30  1e+0,
31  1e+1, 1e+2, 1e+3, 1e+4, 1e+5, 1e+6, 1e+7, 1e+8, 1e+9, 1e+10, 1e+11, 1e+12, 1e+13, 1e+14, 1e+15, 1e+16, 1e+17, 1e+18, 1e+19, 1e+20,
32  1e+21, 1e+22, 1e+23, 1e+24, 1e+25, 1e+26, 1e+27, 1e+28, 1e+29, 1e+30, 1e+31, 1e+32, 1e+33, 1e+34, 1e+35, 1e+36, 1e+37, 1e+38, 1e+39, 1e+40,
33  1e+41, 1e+42, 1e+43, 1e+44, 1e+45, 1e+46, 1e+47, 1e+48, 1e+49, 1e+50, 1e+51, 1e+52, 1e+53, 1e+54, 1e+55, 1e+56, 1e+57, 1e+58, 1e+59, 1e+60,
34  1e+61, 1e+62, 1e+63, 1e+64, 1e+65, 1e+66, 1e+67, 1e+68, 1e+69, 1e+70, 1e+71, 1e+72, 1e+73, 1e+74, 1e+75, 1e+76, 1e+77, 1e+78, 1e+79, 1e+80,
35  1e+81, 1e+82, 1e+83, 1e+84, 1e+85, 1e+86, 1e+87, 1e+88, 1e+89, 1e+90, 1e+91, 1e+92, 1e+93, 1e+94, 1e+95, 1e+96, 1e+97, 1e+98, 1e+99, 1e+100,
36  1e+101,1e+102,1e+103,1e+104,1e+105,1e+106,1e+107,1e+108,1e+109,1e+110,1e+111,1e+112,1e+113,1e+114,1e+115,1e+116,1e+117,1e+118,1e+119,1e+120,
37  1e+121,1e+122,1e+123,1e+124,1e+125,1e+126,1e+127,1e+128,1e+129,1e+130,1e+131,1e+132,1e+133,1e+134,1e+135,1e+136,1e+137,1e+138,1e+139,1e+140,
38  1e+141,1e+142,1e+143,1e+144,1e+145,1e+146,1e+147,1e+148,1e+149,1e+150,1e+151,1e+152,1e+153,1e+154,1e+155,1e+156,1e+157,1e+158,1e+159,1e+160,
39  1e+161,1e+162,1e+163,1e+164,1e+165,1e+166,1e+167,1e+168,1e+169,1e+170,1e+171,1e+172,1e+173,1e+174,1e+175,1e+176,1e+177,1e+178,1e+179,1e+180,
40  1e+181,1e+182,1e+183,1e+184,1e+185,1e+186,1e+187,1e+188,1e+189,1e+190,1e+191,1e+192,1e+193,1e+194,1e+195,1e+196,1e+197,1e+198,1e+199,1e+200,
41  1e+201,1e+202,1e+203,1e+204,1e+205,1e+206,1e+207,1e+208,1e+209,1e+210,1e+211,1e+212,1e+213,1e+214,1e+215,1e+216,1e+217,1e+218,1e+219,1e+220,
42  1e+221,1e+222,1e+223,1e+224,1e+225,1e+226,1e+227,1e+228,1e+229,1e+230,1e+231,1e+232,1e+233,1e+234,1e+235,1e+236,1e+237,1e+238,1e+239,1e+240,
43  1e+241,1e+242,1e+243,1e+244,1e+245,1e+246,1e+247,1e+248,1e+249,1e+250,1e+251,1e+252,1e+253,1e+254,1e+255,1e+256,1e+257,1e+258,1e+259,1e+260,
44  1e+261,1e+262,1e+263,1e+264,1e+265,1e+266,1e+267,1e+268,1e+269,1e+270,1e+271,1e+272,1e+273,1e+274,1e+275,1e+276,1e+277,1e+278,1e+279,1e+280,
45  1e+281,1e+282,1e+283,1e+284,1e+285,1e+286,1e+287,1e+288,1e+289,1e+290,1e+291,1e+292,1e+293,1e+294,1e+295,1e+296,1e+297,1e+298,1e+299,1e+300,
46  1e+301,1e+302,1e+303,1e+304,1e+305,1e+306,1e+307,1e+308
47  };
48  RAPIDJSON_ASSERT(n >= 0 && n <= 308);
49  return e[n];
50 }
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:406
const double e
std::void_t< T > n
char* internal::Prettify ( char *  buffer,
int  length,
int  k,
int  maxDecimalPlaces 
)
inline

Definition at line 150 of file dtoa.h.

150  {
151  const int kk = length + k; // 10^(kk-1) <= v < 10^kk
152 
153  if (0 <= k && kk <= 21) {
154  // 1234e7 -> 12340000000
155  for (int i = length; i < kk; i++)
156  buffer[i] = '0';
157  buffer[kk] = '.';
158  buffer[kk + 1] = '0';
159  return &buffer[kk + 2];
160  }
161  else if (0 < kk && kk <= 21) {
162  // 1234e-2 -> 12.34
163  std::memmove(&buffer[kk + 1], &buffer[kk], static_cast<size_t>(length - kk));
164  buffer[kk] = '.';
165  if (0 > k + maxDecimalPlaces) {
166  // When maxDecimalPlaces = 2, 1.2345 -> 1.23, 1.102 -> 1.1
167  // Remove extra trailing zeros (at least one) after truncation.
168  for (int i = kk + maxDecimalPlaces; i > kk + 1; i--)
169  if (buffer[i] != '0')
170  return &buffer[i + 1];
171  return &buffer[kk + 2]; // Reserve one zero
172  }
173  else
174  return &buffer[length + 1];
175  }
176  else if (-6 < kk && kk <= 0) {
177  // 1234e-6 -> 0.001234
178  const int offset = 2 - kk;
179  std::memmove(&buffer[offset], &buffer[0], static_cast<size_t>(length));
180  buffer[0] = '0';
181  buffer[1] = '.';
182  for (int i = 2; i < offset; i++)
183  buffer[i] = '0';
184  if (length - kk > maxDecimalPlaces) {
185  // When maxDecimalPlaces = 2, 0.123 -> 0.12, 0.102 -> 0.1
186  // Remove extra trailing zeros (at least one) after truncation.
187  for (int i = maxDecimalPlaces + 1; i > 2; i--)
188  if (buffer[i] != '0')
189  return &buffer[i + 1];
190  return &buffer[3]; // Reserve one zero
191  }
192  else
193  return &buffer[length + offset];
194  }
195  else if (kk < -maxDecimalPlaces) {
196  // Truncate to zero
197  buffer[0] = '0';
198  buffer[1] = '.';
199  buffer[2] = '0';
200  return &buffer[3];
201  }
202  else if (length == 1) {
203  // 1e30
204  buffer[1] = 'e';
205  return WriteExponent(kk - 1, &buffer[2]);
206  }
207  else {
208  // 1234e30 -> 1.234e33
209  std::memmove(&buffer[2], &buffer[1], static_cast<size_t>(length - 1));
210  buffer[1] = '.';
211  buffer[length + 1] = 'e';
212  return WriteExponent(kk - 1, &buffer[0 + length + 2]);
213  }
214 }
char * WriteExponent(int K, char *buffer)
Definition: dtoa.h:126
template<typename Ch >
SizeType internal::StrLen ( const Ch *  s)
inline

Custom strlen() which works on different character types.

Template Parameters
ChCharacter type (e.g. char, wchar_t, short)
Parameters
sNull-terminated input string.
Returns
Number of characters in the string.
Note
This has the same semantics as strlen(), the return value is not number of Unicode codepoints.

Definition at line 31 of file strfunc.h.

31  {
32  RAPIDJSON_ASSERT(s != 0);
33  const Ch* p = s;
34  while (*p) ++p;
35  return SizeType(p - s);
36 }
RAPIDJSON_NAMESPACE_BEGIN typedef unsigned SizeType
Size type (for string lengths, array sizes, etc.)
Definition: rapidjson.h:384
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:406
p
Definition: test.py:223
static QCString * s
Definition: config.cpp:1042
template<>
SizeType internal::StrLen ( const char *  s)
inline

Definition at line 39 of file strfunc.h.

39  {
40  return SizeType(std::strlen(s));
41 }
RAPIDJSON_NAMESPACE_BEGIN typedef unsigned SizeType
Size type (for string lengths, array sizes, etc.)
Definition: rapidjson.h:384
static QCString * s
Definition: config.cpp:1042
template<>
SizeType internal::StrLen ( const wchar_t *  s)
inline

Definition at line 44 of file strfunc.h.

44  {
45  return SizeType(std::wcslen(s));
46 }
RAPIDJSON_NAMESPACE_BEGIN typedef unsigned SizeType
Size type (for string lengths, array sizes, etc.)
Definition: rapidjson.h:384
static QCString * s
Definition: config.cpp:1042
double internal::StrtodBigInteger ( double  approx,
const char *  decimals,
int  dLen,
int  dExp 
)
inline

Definition at line 208 of file strtod.h.

208  {
209  RAPIDJSON_ASSERT(dLen >= 0);
210  const BigInteger dInt(decimals, static_cast<unsigned>(dLen));
211  Double a(approx);
212  int cmp = CheckWithinHalfULP(a.Value(), dInt, dExp);
213  if (cmp < 0)
214  return a.Value(); // within half ULP
215  else if (cmp == 0) {
216  // Round towards even
217  if (a.Significand() & 1)
218  return a.NextPositiveDouble();
219  else
220  return a.Value();
221  }
222  else // adjustment
223  return a.NextPositiveDouble();
224 }
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:406
int CheckWithinHalfULP(double b, const BigInteger &d, int dExp)
Definition: strtod.h:56
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition: pointer.h:1124
bool internal::StrtodDiyFp ( const char *  decimals,
int  dLen,
int  dExp,
double *  result 
)
inline

Definition at line 131 of file strtod.h.

131  {
132  uint64_t significand = 0;
133  int i = 0; // 2^64 - 1 = 18446744073709551615, 1844674407370955161 = 0x1999999999999999
134  for (; i < dLen; i++) {
135  if (significand > RAPIDJSON_UINT64_C2(0x19999999, 0x99999999) ||
136  (significand == RAPIDJSON_UINT64_C2(0x19999999, 0x99999999) && decimals[i] > '5'))
137  break;
138  significand = significand * 10u + static_cast<unsigned>(decimals[i] - '0');
139  }
140 
141  if (i < dLen && decimals[i] >= '5') // Rounding
142  significand++;
143 
144  int remaining = dLen - i;
145  const int kUlpShift = 3;
146  const int kUlp = 1 << kUlpShift;
147  int64_t error = (remaining == 0) ? 0 : kUlp / 2;
148 
149  DiyFp v(significand, 0);
150  v = v.Normalize();
151  error <<= -v.e;
152 
153  dExp += remaining;
154 
155  int actualExp;
156  DiyFp cachedPower = GetCachedPower10(dExp, &actualExp);
157  if (actualExp != dExp) {
158  static const DiyFp kPow10[] = {
159  DiyFp(RAPIDJSON_UINT64_C2(0xa0000000, 0x00000000), -60), // 10^1
160  DiyFp(RAPIDJSON_UINT64_C2(0xc8000000, 0x00000000), -57), // 10^2
161  DiyFp(RAPIDJSON_UINT64_C2(0xfa000000, 0x00000000), -54), // 10^3
162  DiyFp(RAPIDJSON_UINT64_C2(0x9c400000, 0x00000000), -50), // 10^4
163  DiyFp(RAPIDJSON_UINT64_C2(0xc3500000, 0x00000000), -47), // 10^5
164  DiyFp(RAPIDJSON_UINT64_C2(0xf4240000, 0x00000000), -44), // 10^6
165  DiyFp(RAPIDJSON_UINT64_C2(0x98968000, 0x00000000), -40) // 10^7
166  };
167  int adjustment = dExp - actualExp;
168  RAPIDJSON_ASSERT(adjustment >= 1 && adjustment < 8);
169  v = v * kPow10[adjustment - 1];
170  if (dLen + adjustment > 19) // has more digits than decimal digits in 64-bit
171  error += kUlp / 2;
172  }
173 
174  v = v * cachedPower;
175 
176  error += kUlp + (error == 0 ? 0 : 1);
177 
178  const int oldExp = v.e;
179  v = v.Normalize();
180  error <<= oldExp - v.e;
181 
182  const int effectiveSignificandSize = Double::EffectiveSignificandSize(64 + v.e);
183  int precisionSize = 64 - effectiveSignificandSize;
184  if (precisionSize + kUlpShift >= 64) {
185  int scaleExp = (precisionSize + kUlpShift) - 63;
186  v.f >>= scaleExp;
187  v.e += scaleExp;
188  error = (error >> scaleExp) + 1 + kUlp;
189  precisionSize -= scaleExp;
190  }
191 
192  DiyFp rounded(v.f >> precisionSize, v.e + precisionSize);
193  const uint64_t precisionBits = (v.f & ((uint64_t(1) << precisionSize) - 1)) * kUlp;
194  const uint64_t halfWay = (uint64_t(1) << (precisionSize - 1)) * kUlp;
195  if (precisionBits >= halfWay + static_cast<unsigned>(error)) {
196  rounded.f++;
197  if (rounded.f & (DiyFp::kDpHiddenBit << 1)) { // rounding overflows mantissa (issue #340)
198  rounded.f >>= 1;
199  rounded.e++;
200  }
201  }
202 
203  *result = rounded.ToDouble();
204 
205  return halfWay - static_cast<unsigned>(error) >= precisionBits || precisionBits >= halfWay + static_cast<unsigned>(error);
206 }
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:406
static QCString result
#define RAPIDJSON_UINT64_C2(high32, low32)
Construct a 64-bit literal by a pair of 32-bit integer.
Definition: rapidjson.h:289
error
Definition: include.cc:26
DiyFp GetCachedPower10(int exp, int *outExp)
Definition: diyfp.h:252
unsigned __int64 uint64_t
Definition: stdint.h:136
signed __int64 int64_t
Definition: stdint.h:135
bool internal::StrtodFast ( double  d,
int  p,
double *  result 
)
inline

Definition at line 113 of file strtod.h.

113  {
114  // Use fast path for string-to-double conversion if possible
115  // see http://www.exploringbinary.com/fast-path-decimal-to-floating-point-conversion/
116  if (p > 22 && p < 22 + 16) {
117  // Fast Path Cases In Disguise
118  d *= internal::Pow10(p - 22);
119  p = 22;
120  }
121 
122  if (p >= -22 && p <= 22 && d <= 9007199254740991.0) { // 2^53 - 1
123  *result = FastPath(d, p);
124  return true;
125  }
126  else
127  return false;
128 }
static QCString result
p
Definition: test.py:223
double Pow10(int n)
Computes integer powers of 10 in double (10.0^n).
Definition: pow10.h:28
double FastPath(double significand, int exp)
Definition: strtod.h:28
double internal::StrtodFullPrecision ( double  d,
int  p,
const char *  decimals,
size_t  length,
size_t  decimalPosition,
int  exp 
)
inline

Definition at line 226 of file strtod.h.

226  {
227  RAPIDJSON_ASSERT(d >= 0.0);
228  RAPIDJSON_ASSERT(length >= 1);
229 
230  double result = 0.0;
231  if (StrtodFast(d, p, &result))
232  return result;
233 
234  RAPIDJSON_ASSERT(length <= INT_MAX);
235  int dLen = static_cast<int>(length);
236 
237  RAPIDJSON_ASSERT(length >= decimalPosition);
238  RAPIDJSON_ASSERT(length - decimalPosition <= INT_MAX);
239  int dExpAdjust = static_cast<int>(length - decimalPosition);
240 
241  RAPIDJSON_ASSERT(exp >= INT_MIN + dExpAdjust);
242  int dExp = exp - dExpAdjust;
243 
244  // Make sure length+dExp does not overflow
245  RAPIDJSON_ASSERT(dExp <= INT_MAX - dLen);
246 
247  // Trim leading zeros
248  while (dLen > 0 && *decimals == '0') {
249  dLen--;
250  decimals++;
251  }
252 
253  // Trim trailing zeros
254  while (dLen > 0 && decimals[dLen - 1] == '0') {
255  dLen--;
256  dExp++;
257  }
258 
259  if (dLen == 0) { // Buffer only contains zeros.
260  return 0.0;
261  }
262 
263  // Trim right-most digits
264  const int kMaxDecimalDigit = 767 + 1;
265  if (dLen > kMaxDecimalDigit) {
266  dExp += dLen - kMaxDecimalDigit;
267  dLen = kMaxDecimalDigit;
268  }
269 
270  // If too small, underflow to zero.
271  // Any x <= 10^-324 is interpreted as zero.
272  if (dLen + dExp <= -324)
273  return 0.0;
274 
275  // If too large, overflow to infinity.
276  // Any x >= 10^309 is interpreted as +infinity.
277  if (dLen + dExp > 309)
278  return std::numeric_limits<double>::infinity();
279 
280  if (StrtodDiyFp(decimals, dLen, dExp, &result))
281  return result;
282 
283  // Use approximation from StrtodDiyFp and make adjustment with BigInteger comparison
284  return StrtodBigInteger(result, decimals, dLen, dExp);
285 }
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:406
static QCString result
bool StrtodFast(double d, int p, double *result)
Definition: strtod.h:113
bool StrtodDiyFp(const char *decimals, int dLen, int dExp, double *result)
Definition: strtod.h:131
p
Definition: test.py:223
double StrtodBigInteger(double approx, const char *decimals, int dLen, int dExp)
Definition: strtod.h:208
double internal::StrtodNormalPrecision ( double  d,
int  p 
)
inline

Definition at line 37 of file strtod.h.

37  {
38  if (p < -308) {
39  // Prevent expSum < -308, making Pow10(p) = 0
40  d = FastPath(d, -308);
41  d = FastPath(d, p + 308);
42  }
43  else
44  d = FastPath(d, p);
45  return d;
46 }
p
Definition: test.py:223
double FastPath(double significand, int exp)
Definition: strtod.h:28
template<typename T >
void internal::Swap ( T &  a,
T &  b 
)
inline

Custom swap() to avoid dependency on C++ <algorithm> header.

Template Parameters
TType of the arguments to swap, should be instantiated with primitive C++ types only.
Note
This has the same semantics as std::swap().

Definition at line 33 of file swap.h.

33  {
34  T tmp = a;
35  a = b;
36  b = tmp;
37 }
string tmp
Definition: languages.py:63
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition: pointer.h:1124
static bool * b
Definition: config.cpp:1043
char* internal::u32toa ( uint32_t  value,
char *  buffer 
)
inline

Definition at line 39 of file itoa.h.

39  {
40  RAPIDJSON_ASSERT(buffer != 0);
41 
42  const char* cDigitsLut = GetDigitsLut();
43 
44  if (value < 10000) {
45  const uint32_t d1 = (value / 100) << 1;
46  const uint32_t d2 = (value % 100) << 1;
47 
48  if (value >= 1000)
49  *buffer++ = cDigitsLut[d1];
50  if (value >= 100)
51  *buffer++ = cDigitsLut[d1 + 1];
52  if (value >= 10)
53  *buffer++ = cDigitsLut[d2];
54  *buffer++ = cDigitsLut[d2 + 1];
55  }
56  else if (value < 100000000) {
57  // value = bbbbcccc
58  const uint32_t b = value / 10000;
59  const uint32_t c = value % 10000;
60 
61  const uint32_t d1 = (b / 100) << 1;
62  const uint32_t d2 = (b % 100) << 1;
63 
64  const uint32_t d3 = (c / 100) << 1;
65  const uint32_t d4 = (c % 100) << 1;
66 
67  if (value >= 10000000)
68  *buffer++ = cDigitsLut[d1];
69  if (value >= 1000000)
70  *buffer++ = cDigitsLut[d1 + 1];
71  if (value >= 100000)
72  *buffer++ = cDigitsLut[d2];
73  *buffer++ = cDigitsLut[d2 + 1];
74 
75  *buffer++ = cDigitsLut[d3];
76  *buffer++ = cDigitsLut[d3 + 1];
77  *buffer++ = cDigitsLut[d4];
78  *buffer++ = cDigitsLut[d4 + 1];
79  }
80  else {
81  // value = aabbbbcccc in decimal
82 
83  const uint32_t a = value / 100000000; // 1 to 42
84  value %= 100000000;
85 
86  if (a >= 10) {
87  const unsigned i = a << 1;
88  *buffer++ = cDigitsLut[i];
89  *buffer++ = cDigitsLut[i + 1];
90  }
91  else
92  *buffer++ = static_cast<char>('0' + static_cast<char>(a));
93 
94  const uint32_t b = value / 10000; // 0 to 9999
95  const uint32_t c = value % 10000; // 0 to 9999
96 
97  const uint32_t d1 = (b / 100) << 1;
98  const uint32_t d2 = (b % 100) << 1;
99 
100  const uint32_t d3 = (c / 100) << 1;
101  const uint32_t d4 = (c % 100) << 1;
102 
103  *buffer++ = cDigitsLut[d1];
104  *buffer++ = cDigitsLut[d1 + 1];
105  *buffer++ = cDigitsLut[d2];
106  *buffer++ = cDigitsLut[d2 + 1];
107  *buffer++ = cDigitsLut[d3];
108  *buffer++ = cDigitsLut[d3 + 1];
109  *buffer++ = cDigitsLut[d4];
110  *buffer++ = cDigitsLut[d4 + 1];
111  }
112  return buffer;
113 }
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:406
const char * GetDigitsLut()
Definition: itoa.h:23
unsigned int uint32_t
Definition: stdint.h:126
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition: pointer.h:1124
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1225
static bool * b
Definition: config.cpp:1043
char* internal::u64toa ( uint64_t  value,
char *  buffer 
)
inline

Definition at line 126 of file itoa.h.

126  {
127  RAPIDJSON_ASSERT(buffer != 0);
128  const char* cDigitsLut = GetDigitsLut();
129  const uint64_t kTen8 = 100000000;
130  const uint64_t kTen9 = kTen8 * 10;
131  const uint64_t kTen10 = kTen8 * 100;
132  const uint64_t kTen11 = kTen8 * 1000;
133  const uint64_t kTen12 = kTen8 * 10000;
134  const uint64_t kTen13 = kTen8 * 100000;
135  const uint64_t kTen14 = kTen8 * 1000000;
136  const uint64_t kTen15 = kTen8 * 10000000;
137  const uint64_t kTen16 = kTen8 * kTen8;
138 
139  if (value < kTen8) {
140  uint32_t v = static_cast<uint32_t>(value);
141  if (v < 10000) {
142  const uint32_t d1 = (v / 100) << 1;
143  const uint32_t d2 = (v % 100) << 1;
144 
145  if (v >= 1000)
146  *buffer++ = cDigitsLut[d1];
147  if (v >= 100)
148  *buffer++ = cDigitsLut[d1 + 1];
149  if (v >= 10)
150  *buffer++ = cDigitsLut[d2];
151  *buffer++ = cDigitsLut[d2 + 1];
152  }
153  else {
154  // value = bbbbcccc
155  const uint32_t b = v / 10000;
156  const uint32_t c = v % 10000;
157 
158  const uint32_t d1 = (b / 100) << 1;
159  const uint32_t d2 = (b % 100) << 1;
160 
161  const uint32_t d3 = (c / 100) << 1;
162  const uint32_t d4 = (c % 100) << 1;
163 
164  if (value >= 10000000)
165  *buffer++ = cDigitsLut[d1];
166  if (value >= 1000000)
167  *buffer++ = cDigitsLut[d1 + 1];
168  if (value >= 100000)
169  *buffer++ = cDigitsLut[d2];
170  *buffer++ = cDigitsLut[d2 + 1];
171 
172  *buffer++ = cDigitsLut[d3];
173  *buffer++ = cDigitsLut[d3 + 1];
174  *buffer++ = cDigitsLut[d4];
175  *buffer++ = cDigitsLut[d4 + 1];
176  }
177  }
178  else if (value < kTen16) {
179  const uint32_t v0 = static_cast<uint32_t>(value / kTen8);
180  const uint32_t v1 = static_cast<uint32_t>(value % kTen8);
181 
182  const uint32_t b0 = v0 / 10000;
183  const uint32_t c0 = v0 % 10000;
184 
185  const uint32_t d1 = (b0 / 100) << 1;
186  const uint32_t d2 = (b0 % 100) << 1;
187 
188  const uint32_t d3 = (c0 / 100) << 1;
189  const uint32_t d4 = (c0 % 100) << 1;
190 
191  const uint32_t b1 = v1 / 10000;
192  const uint32_t c1 = v1 % 10000;
193 
194  const uint32_t d5 = (b1 / 100) << 1;
195  const uint32_t d6 = (b1 % 100) << 1;
196 
197  const uint32_t d7 = (c1 / 100) << 1;
198  const uint32_t d8 = (c1 % 100) << 1;
199 
200  if (value >= kTen15)
201  *buffer++ = cDigitsLut[d1];
202  if (value >= kTen14)
203  *buffer++ = cDigitsLut[d1 + 1];
204  if (value >= kTen13)
205  *buffer++ = cDigitsLut[d2];
206  if (value >= kTen12)
207  *buffer++ = cDigitsLut[d2 + 1];
208  if (value >= kTen11)
209  *buffer++ = cDigitsLut[d3];
210  if (value >= kTen10)
211  *buffer++ = cDigitsLut[d3 + 1];
212  if (value >= kTen9)
213  *buffer++ = cDigitsLut[d4];
214 
215  *buffer++ = cDigitsLut[d4 + 1];
216  *buffer++ = cDigitsLut[d5];
217  *buffer++ = cDigitsLut[d5 + 1];
218  *buffer++ = cDigitsLut[d6];
219  *buffer++ = cDigitsLut[d6 + 1];
220  *buffer++ = cDigitsLut[d7];
221  *buffer++ = cDigitsLut[d7 + 1];
222  *buffer++ = cDigitsLut[d8];
223  *buffer++ = cDigitsLut[d8 + 1];
224  }
225  else {
226  const uint32_t a = static_cast<uint32_t>(value / kTen16); // 1 to 1844
227  value %= kTen16;
228 
229  if (a < 10)
230  *buffer++ = static_cast<char>('0' + static_cast<char>(a));
231  else if (a < 100) {
232  const uint32_t i = a << 1;
233  *buffer++ = cDigitsLut[i];
234  *buffer++ = cDigitsLut[i + 1];
235  }
236  else if (a < 1000) {
237  *buffer++ = static_cast<char>('0' + static_cast<char>(a / 100));
238 
239  const uint32_t i = (a % 100) << 1;
240  *buffer++ = cDigitsLut[i];
241  *buffer++ = cDigitsLut[i + 1];
242  }
243  else {
244  const uint32_t i = (a / 100) << 1;
245  const uint32_t j = (a % 100) << 1;
246  *buffer++ = cDigitsLut[i];
247  *buffer++ = cDigitsLut[i + 1];
248  *buffer++ = cDigitsLut[j];
249  *buffer++ = cDigitsLut[j + 1];
250  }
251 
252  const uint32_t v0 = static_cast<uint32_t>(value / kTen8);
253  const uint32_t v1 = static_cast<uint32_t>(value % kTen8);
254 
255  const uint32_t b0 = v0 / 10000;
256  const uint32_t c0 = v0 % 10000;
257 
258  const uint32_t d1 = (b0 / 100) << 1;
259  const uint32_t d2 = (b0 % 100) << 1;
260 
261  const uint32_t d3 = (c0 / 100) << 1;
262  const uint32_t d4 = (c0 % 100) << 1;
263 
264  const uint32_t b1 = v1 / 10000;
265  const uint32_t c1 = v1 % 10000;
266 
267  const uint32_t d5 = (b1 / 100) << 1;
268  const uint32_t d6 = (b1 % 100) << 1;
269 
270  const uint32_t d7 = (c1 / 100) << 1;
271  const uint32_t d8 = (c1 % 100) << 1;
272 
273  *buffer++ = cDigitsLut[d1];
274  *buffer++ = cDigitsLut[d1 + 1];
275  *buffer++ = cDigitsLut[d2];
276  *buffer++ = cDigitsLut[d2 + 1];
277  *buffer++ = cDigitsLut[d3];
278  *buffer++ = cDigitsLut[d3 + 1];
279  *buffer++ = cDigitsLut[d4];
280  *buffer++ = cDigitsLut[d4 + 1];
281  *buffer++ = cDigitsLut[d5];
282  *buffer++ = cDigitsLut[d5 + 1];
283  *buffer++ = cDigitsLut[d6];
284  *buffer++ = cDigitsLut[d6 + 1];
285  *buffer++ = cDigitsLut[d7];
286  *buffer++ = cDigitsLut[d7 + 1];
287  *buffer++ = cDigitsLut[d8];
288  *buffer++ = cDigitsLut[d8 + 1];
289  }
290 
291  return buffer;
292 }
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:406
const char * GetDigitsLut()
Definition: itoa.h:23
unsigned int uint32_t
Definition: stdint.h:126
unsigned __int64 uint64_t
Definition: stdint.h:136
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition: pointer.h:1124
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1225
static bool * b
Definition: config.cpp:1043
char* internal::WriteExponent ( int  K,
char *  buffer 
)
inline

Definition at line 126 of file dtoa.h.

126  {
127  if (K < 0) {
128  *buffer++ = '-';
129  K = -K;
130  }
131 
132  if (K >= 100) {
133  *buffer++ = static_cast<char>('0' + static_cast<char>(K / 100));
134  K %= 100;
135  const char* d = GetDigitsLut() + K * 2;
136  *buffer++ = d[0];
137  *buffer++ = d[1];
138  }
139  else if (K >= 10) {
140  const char* d = GetDigitsLut() + K * 2;
141  *buffer++ = d[0];
142  *buffer++ = d[1];
143  }
144  else
145  *buffer++ = static_cast<char>('0' + static_cast<char>(K));
146 
147  return buffer;
148 }
const char * GetDigitsLut()
Definition: itoa.h:23

Variable Documentation

const SizeType internal::kRegexInvalidRange = ~SizeType(0)
static

Definition at line 76 of file regex.h.

const SizeType internal::kRegexInvalidState = ~SizeType(0)
static

Represents an invalid index in GenericRegex::State::out, out1.

Definition at line 75 of file regex.h.