Update conversion functions

This commit is contained in:
JeremyStar™ 2024-02-10 18:48:37 +01:00
parent 0b9baa8600
commit 0e0afa60fc

View file

@ -33,11 +33,14 @@ func byte2mib(bytes: int, flatten: bool = true) -> float:
if flatten: return bytes/1048576 if flatten: return bytes/1048576
return bytes/float(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: func mib2gib(mib: float, flatten: bool = true) -> float:
if flatten: return int(mib)/1024 if flatten: return int(mib/1024)
return mib/float(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