equal
deleted
inserted
replaced
239 }; |
239 }; |
240 |
240 |
241 // TODO |
241 // TODO |
242 static char *FormatCommaNumber(char *buff, int32 number, const char* last) |
242 static char *FormatCommaNumber(char *buff, int32 number, const char* last) |
243 { |
243 { |
244 uint32 quot,divisor; |
244 uint32 quot; |
245 int i; |
245 int i; |
246 uint32 tot; |
246 uint32 tot; |
247 uint32 num; |
247 uint32 num; |
248 |
248 |
249 if (number < 0) { |
249 if (number < 0) { |
253 |
253 |
254 num = number; |
254 num = number; |
255 |
255 |
256 tot = 0; |
256 tot = 0; |
257 for (i = 0; i != 10; i++) { |
257 for (i = 0; i != 10; i++) { |
258 divisor = _divisor_table[i]; |
|
259 quot = 0; |
258 quot = 0; |
260 if (num >= divisor) { |
259 if (num >= _divisor_table[i]) { |
261 quot = num / _divisor_table[i]; |
260 quot = num / _divisor_table[i]; |
262 num = num % _divisor_table[i]; |
261 num = num % _divisor_table[i]; |
263 } |
262 } |
264 if (tot |= quot || i == 9) { |
263 if (tot |= quot || i == 9) { |
265 *buff++ = '0' + quot; |
264 *buff++ = '0' + quot; |
273 } |
272 } |
274 |
273 |
275 // TODO |
274 // TODO |
276 static char *FormatNoCommaNumber(char *buff, int32 number, const char* last) |
275 static char *FormatNoCommaNumber(char *buff, int32 number, const char* last) |
277 { |
276 { |
278 uint32 quot,divisor; |
277 uint32 quot; |
279 int i; |
278 int i; |
280 uint32 tot; |
279 uint32 tot; |
281 uint32 num; |
280 uint32 num; |
282 |
281 |
283 if (number < 0) { |
282 if (number < 0) { |
287 |
286 |
288 num = number; |
287 num = number; |
289 |
288 |
290 tot = 0; |
289 tot = 0; |
291 for (i = 0; i != 10; i++) { |
290 for (i = 0; i != 10; i++) { |
292 divisor = _divisor_table[i]; |
|
293 quot = 0; |
291 quot = 0; |
294 if (num >= divisor) { |
292 if (num >= _divisor_table[i]) { |
295 quot = num / _divisor_table[i]; |
293 quot = num / _divisor_table[i]; |
296 num = num % _divisor_table[i]; |
294 num = num % _divisor_table[i]; |
297 } |
295 } |
298 if (tot |= quot || i == 9) { |
296 if (tot |= quot || i == 9) { |
299 *buff++ = '0' + quot; |
297 *buff++ = '0' + quot; |