39 '0',
'0',
'0',
'1',
'0',
'2',
'0',
'3',
'0',
'4',
'0',
'5',
'0',
'6',
'0',
'7',
'0',
'8',
'0',
'9',
40 '1',
'0',
'1',
'1',
'1',
'2',
'1',
'3',
'1',
'4',
'1',
'5',
'1',
'6',
'1',
'7',
'1',
'8',
'1',
'9',
41 '2',
'0',
'2',
'1',
'2',
'2',
'2',
'3',
'2',
'4',
'2',
'5',
'2',
'6',
'2',
'7',
'2',
'8',
'2',
'9',
42 '3',
'0',
'3',
'1',
'3',
'2',
'3',
'3',
'3',
'4',
'3',
'5',
'3',
'6',
'3',
'7',
'3',
'8',
'3',
'9',
43 '4',
'0',
'4',
'1',
'4',
'2',
'4',
'3',
'4',
'4',
'4',
'5',
'4',
'6',
'4',
'7',
'4',
'8',
'4',
'9',
44 '5',
'0',
'5',
'1',
'5',
'2',
'5',
'3',
'5',
'4',
'5',
'5',
'5',
'6',
'5',
'7',
'5',
'8',
'5',
'9',
45 '6',
'0',
'6',
'1',
'6',
'2',
'6',
'3',
'6',
'4',
'6',
'5',
'6',
'6',
'6',
'7',
'6',
'8',
'6',
'9',
46 '7',
'0',
'7',
'1',
'7',
'2',
'7',
'3',
'7',
'4',
'7',
'5',
'7',
'6',
'7',
'7',
'7',
'8',
'7',
'9',
47 '8',
'0',
'8',
'1',
'8',
'2',
'8',
'3',
'8',
'4',
'8',
'5',
'8',
'6',
'8',
'7',
'8',
'8',
'8',
'9',
48 '9',
'0',
'9',
'1',
'9',
'2',
'9',
'3',
'9',
'4',
'9',
'5',
'9',
'6',
'9',
'7',
'9',
'8',
'9',
'9' 84 #if defined(_MSC_VER) || defined(__GNUC__) 85 static const uint32_t powers_of_10[] =
101 _BitScanReverse(&i, n | 1);
102 uint32_t t = (i + 1) * 1233 >> 12;
104 uint32_t t = (32 - __builtin_clz(n | 1)) * 1233 >> 12;
106 return t - (n < powers_of_10[t]) + 1;
109 if (n < 10)
return 1;
110 if (n < 100)
return 2;
111 if (n < 1000)
return 3;
112 if (n < 10000)
return 4;
113 if (n < 100000)
return 5;
114 if (n < 1000000)
return 6;
115 if (n < 10000000)
return 7;
116 if (n < 100000000)
return 8;
117 if (n < 1000000000)
return 9;
124 #if defined(_MSC_VER) || defined(__GNUC__) 125 static const uint64_t powers_of_10[] =
146 10000000000000000000U
152 if (_BitScanReverse(&i, m >> 32))
155 _BitScanReverse(&i, m & 0xFFFFFFFF);
156 uint32_t t = (i + 1) * 1233 >> 12;
159 _BitScanReverse64(&i, n | 1);
160 uint32_t t = (i + 1) * 1233 >> 12;
162 uint32_t t = (64 - __builtin_clzll(n | 1)) * 1233 >> 12;
164 return t - (n < powers_of_10[t]) + 1;
167 if (n < 10)
return 1;
168 if (n < 100)
return 2;
169 if (n < 1000)
return 3;
170 if (n < 10000)
return 4;
171 if (n < 100000)
return 5;
172 if (n < 1000000)
return 6;
173 if (n < 10000000)
return 7;
174 if (n < 100000000)
return 8;
175 if (n < 1000000000)
return 9;
176 if (n < 10000000000)
return 10;
177 if (n < 100000000000)
return 11;
178 if (n < 1000000000000)
return 12;
179 if (n < 10000000000000)
return 13;
180 if (n < 100000000000000)
return 14;
181 if (n < 1000000000000000)
return 15;
182 if (n < 10000000000000000)
return 16;
183 if (n < 100000000000000000)
return 17;
184 if (n < 1000000000000000000)
return 18;
185 if (n < 10000000000000000000)
return 19;
void i32toa(int32_t value, char *buffer)
Quickly convert a 32-bit signed integer to a char array (buffer should already be allocated) ...
unsigned CountDecimalDigit32(uint32_t n)
void u32toa(uint32_t value, char *buffer)
Quickly convert a 32-bit unsigned integer to a char array (buffer should already be allocated) ...
const char gDigitsLut[200]
void u64toa(uint64_t value, char *buffer)
Quickly convert a 64-bit unsigned integer to a char array (buffer should already be allocated) ...
unsigned CountDecimalDigit64(uint64_t n)
void i64toa(int64_t value, char *buffer)
Quickly convert a 64-bit signed integer to a char array (buffer should already be allocated) ...