Skip to content

Commit

Permalink
Fix bytefmt boundary
Browse files Browse the repository at this point in the history
  • Loading branch information
xorkevin committed Dec 3, 2023
1 parent e5bb374 commit 0d07f10
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions util/bytefmt/bytefmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,19 @@ func ToBytes(s string) (int64, error) {
func ToString(bytes int64) string {
unitname := "B"
switch {
case bytes > PETABYTE:
case bytes >= PETABYTE:
bytes /= PETABYTE
unitname = "PiB"
case bytes > TERABYTE:
case bytes >= TERABYTE:
bytes /= TERABYTE
unitname = "TiB"
case bytes > GIGABYTE:
case bytes >= GIGABYTE:
bytes /= GIGABYTE
unitname = "GiB"
case bytes > MEGABYTE:
case bytes >= MEGABYTE:
bytes /= MEGABYTE
unitname = "MiB"
case bytes > KILOBYTE:
case bytes >= KILOBYTE:
bytes /= KILOBYTE
unitname = "KiB"
}
Expand Down

0 comments on commit 0d07f10

Please sign in to comment.