Go to the SVN repository for this file.
15 #ifndef RAPIDJSON_ITOA_ 16 #define RAPIDJSON_ITOA_ 18 #include "../rapidjson.h" 24 static const charcDigitsLut[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' 47*
buffer++ = cDigitsLut[d1];
49*
buffer++ = cDigitsLut[d1 + 1];
51*
buffer++ = cDigitsLut[d2];
52*
buffer++ = cDigitsLut[d2 + 1];
54 else if(
value< 100000000) {
65 if(
value>= 10000000)
66*
buffer++ = cDigitsLut[d1];
67 if(
value>= 1000000)
68*
buffer++ = cDigitsLut[d1 + 1];
70*
buffer++ = cDigitsLut[d2];
71*
buffer++ = cDigitsLut[d2 + 1];
73*
buffer++ = cDigitsLut[d3];
74*
buffer++ = cDigitsLut[d3 + 1];
75*
buffer++ = cDigitsLut[d4];
76*
buffer++ = cDigitsLut[d4 + 1];
85 const unsigned i=
a<< 1;
87*
buffer++ = cDigitsLut[
i+ 1];
90*
buffer++ =
static_cast<char>(
'0'+
static_cast<char>(
a));
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];
127 const uint64_tkTen10 = kTen8 * 100;
128 const uint64_tkTen11 = kTen8 * 1000;
129 const uint64_tkTen12 = kTen8 * 10000;
130 const uint64_tkTen13 = kTen8 * 100000;
131 const uint64_tkTen14 = kTen8 * 1000000;
132 const uint64_tkTen15 = kTen8 * 10000000;
133 const uint64_tkTen16 = kTen8 * kTen8;
135 if(
value< kTen8) {
142*
buffer++ = cDigitsLut[d1];
144*
buffer++ = cDigitsLut[d1 + 1];
146*
buffer++ = cDigitsLut[d2];
147*
buffer++ = cDigitsLut[d2 + 1];
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];
168*
buffer++ = cDigitsLut[d3];
169*
buffer++ = cDigitsLut[d3 + 1];
170*
buffer++ = cDigitsLut[d4];
171*
buffer++ = cDigitsLut[d4 + 1];
174 else if(
value< kTen16) {
181 const uint32_td1 = (b0 / 100) << 1;
182 const uint32_td2 = (b0 % 100) << 1;
184 const uint32_td3 = (c0 / 100) << 1;
185 const uint32_td4 = (c0 % 100) << 1;
190 const uint32_td5 = (b1 / 100) << 1;
191 const uint32_td6 = (b1 % 100) << 1;
193 const uint32_td7 = (c1 / 100) << 1;
194 const uint32_td8 = (c1 % 100) << 1;
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];
209*
buffer++ = cDigitsLut[d4];
211*
buffer++ = cDigitsLut[d4 + 1];
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];
227*
buffer++ =
static_cast<char>(
'0'+
static_cast<char>(
a));
231*
buffer++ = cDigitsLut[
i+ 1];
233 else if(
a< 1000) {
234*
buffer++ =
static_cast<char>(
'0'+
static_cast<char>(
a/ 100));
238*
buffer++ = cDigitsLut[
i+ 1];
244*
buffer++ = cDigitsLut[
i+ 1];
245*
buffer++ = cDigitsLut[j];
246*
buffer++ = cDigitsLut[j + 1];
255 const uint32_td1 = (b0 / 100) << 1;
256 const uint32_td2 = (b0 % 100) << 1;
258 const uint32_td3 = (c0 / 100) << 1;
259 const uint32_td4 = (c0 % 100) << 1;
264 const uint32_td5 = (b1 / 100) << 1;
265 const uint32_td6 = (b1 % 100) << 1;
267 const uint32_td7 = (c1 / 100) << 1;
268 const uint32_td8 = (c1 % 100) << 1;
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];
#define RAPIDJSON_NAMESPACE_BEGIN
provide custom rapidjson namespace (opening expression)
#define RAPIDJSON_NAMESPACE_END
provide custom rapidjson namespace (closing expression)
const char * GetDigitsLut()
char * i64toa(int64_t value, char *buffer)
char * u32toa(uint32_t value, char *buffer)
char * i32toa(int32_t value, char *buffer)
char * u64toa(uint64_t value, char *buffer)
const GenericPointer< typename T::ValueType > T2 value
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4