bytes: Fixed `0.1b` rounding up instead of down.

Fortune for units's current commit: Curse − 凶
master
Avril 2 weeks ago
parent 5cde9e6885
commit 3e33be5c32
Signed by: flanchan
GPG Key ID: 284488987C31F630

4
Cargo.lock generated

@ -4,9 +4,9 @@ version = 4
[[package]]
name = "lazy_static"
version = "1.4.0"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]]
name = "rustc_version"

@ -60,6 +60,11 @@ impl Conversion for Bytes
return Err(ConversionError::new_for(self, "Negative byte offsets not supported"));
}
// NOTE: Special-case truncation for if `1.xb` is used.
if u == 1 {
return Ok((o.trunc() as Self::Output, Some(1)));
}
Ok((multiply(o, u), Some(u)))
}
}

Loading…
Cancel
Save