upd convert()
This commit is contained in:
parent
25a1b7bbf0
commit
080e37a7c2
@ -193,5 +193,8 @@ pub const yibit = zibit * 1024
|
|||||||
// assert dataunits.convert(500, dataunits.mbit, dataunits.kb) == 62500
|
// assert dataunits.convert(500, dataunits.mbit, dataunits.kb) == 62500
|
||||||
// ````
|
// ````
|
||||||
pub fn convert(value f64, from DataSize, to DataSize) f64 {
|
pub fn convert(value f64, from DataSize, to DataSize) f64 {
|
||||||
|
if from == to {
|
||||||
|
return value
|
||||||
|
}
|
||||||
return f64(value * from / to)
|
return f64(value * from / to)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user