File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/util Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ private enum Unit {
4444 // We want to respect MAX_WIDTH and keep it concise,
4545 // so we prefer to show 0.99MiB than 1010.00KiB (length 10).
4646 public static String bytesToHuman (long bytes ) {
47- assert bytes >= 0 ;
47+ assert bytes >= 0 : bytes ;
4848 if (bytes < 1_000 ) {
4949 return bytes + "B" ;
5050 } else if (bytes < 1_000 * Unit .KiB .value ) {
@@ -61,8 +61,9 @@ public static String bytesToHumanGB(long bytes) {
6161 }
6262
6363 private static String toHuman (long value , Unit unit ) {
64- String string = "%.2f%s" .formatted ((double ) value / unit .value , unit );
65- assert string .length () <= MAX_WIDTH || value >= 1000L * Unit .GiB .value ;
64+ long scaled = value / unit .value ;
65+ String string = "%.2f%s" .formatted ((double ) scaled , unit .toString ());
66+ assert string .length () <= MAX_WIDTH || value >= 1000L * Unit .GiB .value : value ;
6667 return string ;
6768 }
6869}
You can’t perform that action at this time.
0 commit comments