Update conversion functions
This commit is contained in:
parent
0b9baa8600
commit
0e0afa60fc
1 changed files with 8 additions and 5 deletions
13
src/misc.gd
13
src/misc.gd
|
@ -33,11 +33,14 @@ func byte2mib(bytes: int, flatten: bool = true) -> float:
|
|||
if flatten: return bytes/1048576
|
||||
return bytes/float(1048576)
|
||||
|
||||
func mib2byte(mib: int) -> int: return mib*1048576
|
||||
func mib2byte(mib: float, flatten: bool = true) -> float:
|
||||
if flatten: return int(mib*1048576)
|
||||
return mib*1048576
|
||||
|
||||
@warning_ignore("integer_division")
|
||||
func mib2gib(mib: float, flatten: bool = true) -> float:
|
||||
if flatten: return int(mib)/1024
|
||||
return mib/float(1024)
|
||||
if flatten: return int(mib/1024)
|
||||
return mib/1024
|
||||
|
||||
func gib2mib(gib: float) -> float: return gib*1024
|
||||
func gib2mib(gib: float, flatten: bool = true) -> float:
|
||||
if flatten: return int(gib*1024)
|
||||
return gib*1024
|
||||
|
|
Loading…
Reference in a new issue