diff options
| author | 2023-08-07 08:28:49 +0000 | |
|---|---|---|
| committer | 2023-08-07 08:28:49 +0000 | |
| commit | 517829ae6a5e7a5b426ba6529668bde07fd2e7ea (patch) | |
| tree | c0742bafcd5fe8e525deb15f331a2fb59572439e /vendor/github.com/tdewolff/parse/v2/strconv/price.go | |
| parent | [feature] Allow full BCP 47 in language inputs (#2067) (diff) | |
| download | gotosocial-517829ae6a5e7a5b426ba6529668bde07fd2e7ea.tar.xz | |
[chore]: Bump github.com/tdewolff/minify/v2 from 2.12.7 to 2.12.8 (#2073)
Diffstat (limited to 'vendor/github.com/tdewolff/parse/v2/strconv/price.go')
| -rw-r--r-- | vendor/github.com/tdewolff/parse/v2/strconv/price.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/vendor/github.com/tdewolff/parse/v2/strconv/price.go b/vendor/github.com/tdewolff/parse/v2/strconv/price.go index 94b38343e..18ded69f5 100644 --- a/vendor/github.com/tdewolff/parse/v2/strconv/price.go +++ b/vendor/github.com/tdewolff/parse/v2/strconv/price.go @@ -20,14 +20,14 @@ func AppendPrice(b []byte, price int64, dec bool, milSeparator byte, decSeparato // rounding if !dec { firstDec := (price / 10) % 10 - if firstDec >= 5 { + if 5 <= firstDec { price += 100 } } // calculate size n := LenInt(price) - 2 - if n > 0 { + if 0 < n { n += (n - 1) / 3 // mil separator } else { n = 1 @@ -38,7 +38,7 @@ func AppendPrice(b []byte, price int64, dec bool, milSeparator byte, decSeparato // resize byte slice i := len(b) - if i+n > cap(b) { + if cap(b) < i+n { b = append(b, make([]byte, n)...) } else { b = b[:i+n] @@ -66,7 +66,7 @@ func AppendPrice(b []byte, price int64, dec bool, milSeparator byte, decSeparato // print integer-part j := 0 - for price > 0 { + for 0 < price { if j == 3 { b[i] = milSeparator i-- |
