1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-07-02 16:38:37 +00:00

Simplify formatFileSize

No need to use a loop with divisions and multiplications when we have logarithms.
This commit is contained in:
jvoisin 2024-02-27 20:40:43 +01:00 committed by Frédéric Guillot
parent 9a4a942cc4
commit f274394f0e
2 changed files with 8 additions and 10 deletions

View file

@ -156,6 +156,8 @@ func TestFormatFileSize(t *testing.T) {
input int64
expected string
}{
{0, "0 B"},
{1, "1 B"},
{500, "500 B"},
{1024, "1.0 KiB"},
{43520, "42.5 KiB"},