common: define storage units as constants
Define all used storage units as constants. Use them in `DataSizeToUint64()`, instead of literal multiples.
This commit is contained in:
parent
b5d1c8866a
commit
ff28b0f5d3
2 changed files with 19 additions and 8 deletions
|
|
@ -2,6 +2,17 @@ package common
|
|||
|
||||
import "fmt"
|
||||
|
||||
const (
|
||||
KiloByte = 1000 // kB
|
||||
KibiByte = 1024 // KiB
|
||||
MegaByte = 1000 * 1000 // MB
|
||||
MebiByte = 1024 * 1024 // MiB
|
||||
GigaByte = 1000 * 1000 * 1000 // GB
|
||||
GibiByte = 1024 * 1024 * 1024 // GiB
|
||||
TeraByte = 1000 * 1000 * 1000 * 1000 // TB
|
||||
TebiByte = 1024 * 1024 * 1024 * 1024 // TiB
|
||||
)
|
||||
|
||||
// These constants are set during buildtime using additional
|
||||
// compiler flags. Not all of them are necessarily defined
|
||||
// because RPMs can be build from a tarball and spec file without
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue