(n int64)
| 302 | } |
| 303 | |
| 304 | func commaFormat(n int64) string { |
| 305 | in := strconv.FormatInt(n, 10) |
| 306 | out := make([]byte, len(in)+(len(in)-2+int(in[0]/'0'))/3) |
| 307 | if in[0] == '-' { |
| 308 | in, out[0] = in[1:], '-' |
| 309 | } |
| 310 | for i, j, k := len(in)-1, len(out)-1, 0; ; i, j = i-1, j-1 { |
| 311 | out[j] = in[i] |
| 312 | if i == 0 { |
| 313 | return string(out) |
| 314 | } |
| 315 | if k++; k == 3 { |
| 316 | j, k = j-1, 0 |
| 317 | out[j] = ',' |
| 318 | } |
| 319 | } |
| 320 | } |
| 321 | |
| 322 | // HumanBytes formats bytes as a human readable string |
| 323 | func HumanBytes(bytes float64, si bool) string { |
no outgoing calls
no test coverage detected