TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
internal Namespace Reference

Classes

class  BigInteger
 
struct  DiyFp
 
class  Double
 
struct  IsGenericValue
 
struct  IsGenericValueImpl
 
struct  IsGenericValueImpl< T, typename Void< typename T::EncodingType >::Type, typename Void< typename T::AllocatorType >::Type >
 
class  Stack
 A type-unsafe stack for storing different types of data. More...
 
singleton  StreamLocalCopy
 
class  StreamLocalCopy< Stream, 0 >
 Keep reference. More...
 
class  StreamLocalCopy< Stream, 1 >
 Do copy optimization. More...
 

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)
 
unsigned 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)
 
char * dtoa (double value, char *buffer)
 
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...
 
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, size_t length, size_t decimalPosition, int exp, double *result)
 
double StrtodBigInteger (double approx, const char *decimals, size_t length, size_t decimalPosition, int exp)
 
double StrtodFullPrecision (double d, int p, const char *decimals, size_t length, size_t decimalPosition, int exp)
 

Function Documentation

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

unsigned internal::CountDecimalDigit32 ( uint32_t  n)
inline
43  {
44  // Simple pure C++ implementation was faster than __builtin_clz version in this situation.
45  if (n < 10) return 1;
46  if (n < 100) return 2;
47  if (n < 1000) return 3;
48  if (n < 10000) return 4;
49  if (n < 100000) return 5;
50  if (n < 1000000) return 6;
51  if (n < 10000000) return 7;
52  if (n < 100000000) return 8;
53  // Will not reach 10 digits in DigitGen()
54  //if (n < 1000000000) return 9;
55  //return 10;
56  return 9;
57 }

+ Here is the caller graph for this function:

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

char* internal::dtoa ( double  value,
char *  buffer 
)
inline
189  {
190  Double d(value);
191  if (d.IsZero()) {
192  if (d.Sign())
193  *buffer++ = '-'; // -0.0, Issue #289
194  buffer[0] = '0';
195  buffer[1] = '.';
196  buffer[2] = '0';
197  return &buffer[3];
198  }
199  else {
200  if (value < 0) {
201  *buffer++ = '-';
202  value = -value;
203  }
204  int length, K;
205  Grisu2(value, buffer, &length, &K);
206  return Prettify(buffer, length, K);
207  }
208 }
char * Prettify(char *buffer, int length, int k)
Definition: dtoa.h:148
void Grisu2(double value, char *buffer, int *length, int *K)
Definition: dtoa.h:110
float length(float v)
Definition: vectorMath.h:208
const FieldDescriptor value
Definition: descriptor.h:1522

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

double internal::FastPath ( double  significand,
int  exp 
)
inline
27  {
28  if (exp < -308)
29  return 0.0;
30  else if (exp >= 0)
31  return significand * internal::Pow10(exp);
32  else
33  return significand / internal::Pow10(-exp);
34 }
Quat exp(const Quat &q)
Definition: Quat.h:729
double Pow10(int n)
Computes integer powers of 10 in double (10.0^n).
Definition: pow10.h:28

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

DiyFp internal::GetCachedPower ( int  e,
int *  K 
)
inline
220  {
221 
222  //int k = static_cast<int>(ceil((-61 - e) * 0.30102999566398114)) + 374;
223  double dk = (-61 - e) * 0.30102999566398114 + 347; // dk must be positive, so can do ceiling in positive
224  int k = static_cast<int>(dk);
225  if (dk - k > 0.0)
226  k++;
227 
228  unsigned index = static_cast<unsigned>((k >> 3) + 1);
229  *K = -(-348 + static_cast<int>(index << 3)); // decimal exponent no need lookup table
230 
231  return GetCachedPowerByIndex(index);
232 }
DiyFp GetCachedPowerByIndex(size_t index)
Definition: diyfp.h:158

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

DiyFp internal::GetCachedPower10 ( int  exp,
int *  outExp 
)
inline
234  {
235  unsigned index = (exp + 348) / 8;
236  *outExp = -348 + index * 8;
237  return GetCachedPowerByIndex(index);
238  }
Quat exp(const Quat &q)
Definition: Quat.h:729
DiyFp GetCachedPowerByIndex(size_t index)
Definition: diyfp.h:158

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

+ Here is the caller graph for this function:

const char* internal::GetDigitsLut ( )
inline
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 }

+ Here is the caller graph for this function:

void internal::Grisu2 ( double  value,
char *  buffer,
int *  length,
int *  K 
)
inline
110  {
111  const DiyFp v(value);
112  DiyFp w_m, w_p;
113  v.NormalizedBoundaries(&w_m, &w_p);
114 
115  const DiyFp c_mk = GetCachedPower(w_p.e, K);
116  const DiyFp W = v.Normalize() * c_mk;
117  DiyFp Wp = w_p * c_mk;
118  DiyFp Wm = w_m * c_mk;
119  Wm.f++;
120  Wp.f--;
121  DigitGen(W, Wp, Wp.f - Wm.f, buffer, length, K);
122 }
void DigitGen(const DiyFp &W, const DiyFp &Mp, uint64_t delta, char *buffer, int *len, int *K)
Definition: dtoa.h:59
float length(float v)
Definition: vectorMath.h:208
const FieldDescriptor value
Definition: descriptor.h:1522
DiyFp GetCachedPower(int e, int *K)
Definition: diyfp.h:220

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void internal::GrisuRound ( char *  buffer,
int  len,
uint64_t  delta,
uint64_t  rest,
uint64_t  ten_kappa,
uint64_t  wp_w 
)
inline

closer

34  {
35  while (rest < wp_w && delta - rest >= ten_kappa &&
36  (rest + ten_kappa < wp_w ||
37  wp_w - rest > rest + ten_kappa - wp_w)) {
38  buffer[len - 1]--;
39  rest += ten_kappa;
40  }
41 }

+ Here is the caller graph for this function:

char* internal::i32toa ( int32_t  value,
char *  buffer 
)
inline
113  {
114  uint32_t u = static_cast<uint32_t>(value);
115  if (value < 0) {
116  *buffer++ = '-';
117  u = ~u + 1;
118  }
119 
120  return u32toa(u, buffer);
121 }
unsigned int uint32_t
Definition: stdint.h:80
char * u32toa(uint32_t value, char *buffer)
Definition: itoa.h:39
const FieldDescriptor value
Definition: descriptor.h:1522

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

char* internal::i64toa ( int64_t  value,
char *  buffer 
)
inline
291  {
292  uint64_t u = static_cast<uint64_t>(value);
293  if (value < 0) {
294  *buffer++ = '-';
295  u = ~u + 1;
296  }
297 
298  return u64toa(u, buffer);
299 }
char * u64toa(uint64_t value, char *buffer)
Definition: itoa.h:123
unsigned __int64 uint64_t
Definition: stdint.h:90
const FieldDescriptor value
Definition: descriptor.h:1522

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T >
T internal::Min3 ( a,
b,
c 
)
inline
48  {
49  T m = a;
50  if (m > b) m = b;
51  if (m > c) m = c;
52  return m;
53 }

+ Here is the caller graph for this function:

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
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:344

+ Here is the caller graph for this function:

char* internal::Prettify ( char *  buffer,
int  length,
int  k 
)
inline
148  {
149  const int kk = length + k; // 10^(kk-1) <= v < 10^kk
150 
151  if (length <= kk && kk <= 21) {
152  // 1234e7 -> 12340000000
153  for (int i = length; i < kk; i++)
154  buffer[i] = '0';
155  buffer[kk] = '.';
156  buffer[kk + 1] = '0';
157  return &buffer[kk + 2];
158  }
159  else if (0 < kk && kk <= 21) {
160  // 1234e-2 -> 12.34
161  std::memmove(&buffer[kk + 1], &buffer[kk], length - kk);
162  buffer[kk] = '.';
163  return &buffer[length + 1];
164  }
165  else if (-6 < kk && kk <= 0) {
166  // 1234e-6 -> 0.001234
167  const int offset = 2 - kk;
168  std::memmove(&buffer[offset], &buffer[0], length);
169  buffer[0] = '0';
170  buffer[1] = '.';
171  for (int i = 2; i < offset; i++)
172  buffer[i] = '0';
173  return &buffer[length + offset];
174  }
175  else if (length == 1) {
176  // 1e30
177  buffer[1] = 'e';
178  return WriteExponent(kk - 1, &buffer[2]);
179  }
180  else {
181  // 1234e30 -> 1.234e33
182  std::memmove(&buffer[2], &buffer[1], length - 1);
183  buffer[1] = '.';
184  buffer[length + 1] = 'e';
185  return WriteExponent(kk - 1, &buffer[0 + length + 2]);
186  }
187 }
char * WriteExponent(int K, char *buffer)
Definition: dtoa.h:124
float length(float v)
Definition: vectorMath.h:208

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.
30  {
31  const Ch* p = s;
32  while (*p) ++p;
33  return SizeType(p - s);
34 }
RAPIDJSON_NAMESPACE_BEGIN typedef unsigned SizeType
Size type (for string lengths, array sizes, etc.)
Definition: rapidjson.h:322

+ Here is the caller graph for this function:

double internal::StrtodBigInteger ( double  approx,
const char *  decimals,
size_t  length,
size_t  decimalPosition,
int  exp 
)
inline
207  {
208  const BigInteger dInt(decimals, length);
209  const int dExp = (int)decimalPosition - (int)length + exp;
210  Double a(approx);
211  int cmp = CheckWithinHalfULP(a.Value(), dInt, dExp);
212  if (cmp < 0)
213  return a.Value(); // within half ULP
214  else if (cmp == 0) {
215  // Round towards even
216  if (a.Significand() & 1)
217  return a.NextPositiveDouble();
218  else
219  return a.Value();
220  }
221  else // adjustment
222  return a.NextPositiveDouble();
223 }
Quat exp(const Quat &q)
Definition: Quat.h:729
int CheckWithinHalfULP(double b, const BigInteger &d, int dExp)
Definition: strtod.h:55
float length(float v)
Definition: vectorMath.h:208

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool internal::StrtodFast ( double  d,
int  p,
double *  result 
)
inline
112  {
113  // Use fast path for string-to-double conversion if possible
114  // see http://www.exploringbinary.com/fast-path-decimal-to-floating-point-conversion/
115  if (p > 22 && p < 22 + 16) {
116  // Fast Path Cases In Disguise
117  d *= internal::Pow10(p - 22);
118  p = 22;
119  }
120 
121  if (p >= -22 && p <= 22 && d <= 9007199254740991.0) { // 2^53 - 1
122  *result = FastPath(d, p);
123  return true;
124  }
125  else
126  return false;
127 }
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:27

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

double internal::StrtodFullPrecision ( double  d,
int  p,
const char *  decimals,
size_t  length,
size_t  decimalPosition,
int  exp 
)
inline
225  {
226  RAPIDJSON_ASSERT(d >= 0.0);
227  RAPIDJSON_ASSERT(length >= 1);
228 
229  double result;
230  if (StrtodFast(d, p, &result))
231  return result;
232 
233  // Trim leading zeros
234  while (*decimals == '0' && length > 1) {
235  length--;
236  decimals++;
237  decimalPosition--;
238  }
239 
240  // Trim trailing zeros
241  while (decimals[length - 1] == '0' && length > 1) {
242  length--;
243  decimalPosition--;
244  exp++;
245  }
246 
247  // Trim right-most digits
248  const int kMaxDecimalDigit = 780;
249  if ((int)length > kMaxDecimalDigit) {
250  int delta = (int(length) - kMaxDecimalDigit);
251  exp += delta;
252  decimalPosition -= delta;
253  length = kMaxDecimalDigit;
254  }
255 
256  // If too small, underflow to zero
257  if (int(length) + exp < -324)
258  return 0.0;
259 
260  if (StrtodDiyFp(decimals, length, decimalPosition, exp, &result))
261  return result;
262 
263  // Use approximation from StrtodDiyFp and make adjustment with BigInteger comparison
264  return StrtodBigInteger(result, decimals, length, decimalPosition, exp);
265 }
Quat exp(const Quat &q)
Definition: Quat.h:729
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:344
bool StrtodFast(double d, int p, double *result)
Definition: strtod.h:112
double StrtodBigInteger(double approx, const char *decimals, size_t length, size_t decimalPosition, int exp)
Definition: strtod.h:207
float length(float v)
Definition: vectorMath.h:208
bool StrtodDiyFp(const char *decimals, size_t length, size_t decimalPosition, int exp, double *result)
Definition: strtod.h:130

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

double internal::StrtodNormalPrecision ( double  d,
int  p 
)
inline
36  {
37  if (p < -308) {
38  // Prevent expSum < -308, making Pow10(p) = 0
39  d = FastPath(d, -308);
40  d = FastPath(d, p + 308);
41  }
42  else
43  d = FastPath(d, p);
44  return d;
45 }
double FastPath(double significand, int exp)
Definition: strtod.h:27

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function: