mirror of https://github.com/sbt/sbt.git
You never know
This commit is contained in:
parent
57a5c1b83f
commit
9a43212040
|
|
@ -103,8 +103,9 @@ object TermDisplay {
|
|||
if (bytes < unit)
|
||||
bytes + " B"
|
||||
else {
|
||||
val exp = (math.log(bytes) / math.log(unit)).toInt
|
||||
val pre = (if (si) "kMGTPE" else "KMGTPE").charAt(exp - 1) + (if (si) "" else "i")
|
||||
val prefixes = if (si) "kMGTPE" else "KMGTPE"
|
||||
val exp = (math.log(bytes) / math.log(unit)).toInt min prefixes.length
|
||||
val pre = prefixes.charAt(exp - 1) + (if (si) "" else "i")
|
||||
f"${bytes / math.pow(unit, exp)}%.1f ${pre}B"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue