311 return 0; |
311 return 0; |
312 } |
312 } |
313 return HeapWordSize * x->size(); |
313 return HeapWordSize * x->size(); |
314 } |
314 } |
315 |
315 |
316 // returns a format string to print a julong with the given width. E.g, |
|
317 // printf(num_fmt(6), julong(10)) would print out the number 10 with 4 |
|
318 // leading spaces. |
|
319 PRAGMA_DIAG_PUSH |
|
320 PRAGMA_FORMAT_NONLITERAL_IGNORED |
|
321 |
|
322 static void print_julong(outputStream* st, int width, julong n) { |
316 static void print_julong(outputStream* st, int width, julong n) { |
323 int num_spaces = width - julong_width(n); |
317 int num_spaces = width - julong_width(n); |
324 if (num_spaces > 0) { |
318 if (num_spaces > 0) { |
325 st->print(str_fmt(num_spaces), ""); |
319 st->print("%*s", num_spaces, ""); |
326 } |
320 } |
327 st->print(JULONG_FORMAT, n); |
321 st->print(JULONG_FORMAT, n); |
328 } |
|
329 PRAGMA_DIAG_POP |
|
330 |
|
331 static char* perc_fmt(int width) { |
|
332 static char buf[32]; |
|
333 jio_snprintf(buf, sizeof(buf), "%%%d.1f%%%%", width-1); |
|
334 return buf; |
|
335 } |
|
336 |
|
337 static char* str_fmt(int width) { |
|
338 static char buf[32]; |
|
339 jio_snprintf(buf, sizeof(buf), "%%%ds", width); |
|
340 return buf; |
|
341 } |
322 } |
342 |
323 |
343 static int julong_width(julong n) { |
324 static int julong_width(julong n) { |
344 if (n == 0) { |
325 if (n == 0) { |
345 return 1; |
326 return 1; |