aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/vsprintf.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 8cb7635b2ce3..c2236f14640f 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -174,22 +174,12 @@ char *put_dec_trunc8(char *buf, unsigned r)
174 unsigned q; 174 unsigned q;
175 175
176 /* Copy of previous function's body with added early returns */ 176 /* Copy of previous function's body with added early returns */
177 q = (r * (uint64_t)0x1999999a) >> 32; 177 while (r >= 10000) {
178 *buf++ = (r - 10 * q) + '0'; /* 2 */ 178 q = r + '0';
179 if (q == 0) 179 r = (r * (uint64_t)0x1999999a) >> 32;
180 return buf; 180 *buf++ = q - 10*r;
181 r = (q * (uint64_t)0x1999999a) >> 32; 181 }
182 *buf++ = (q - 10 * r) + '0'; /* 3 */ 182
183 if (r == 0)
184 return buf;
185 q = (r * (uint64_t)0x1999999a) >> 32;
186 *buf++ = (r - 10 * q) + '0'; /* 4 */
187 if (q == 0)
188 return buf;
189 r = (q * (uint64_t)0x1999999a) >> 32;
190 *buf++ = (q - 10 * r) + '0'; /* 5 */
191 if (r == 0)
192 return buf;
193 q = (r * 0x199a) >> 16; 183 q = (r * 0x199a) >> 16;
194 *buf++ = (r - 10 * q) + '0'; /* 6 */ 184 *buf++ = (r - 10 * q) + '0'; /* 6 */
195 if (q == 0) 185 if (q == 0)