Use From in map_to_range

In an effort to remove unnecessary casts use `u128::from` to convert
from `u64`s. Leave the cast to `u64` in there because it is right after
a shift right and is brain-dead obvious.
This commit is contained in:
Tobin C. Harding 2024-08-05 07:29:36 +10:00
parent d9331794f1
commit 342fe18ad0
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
1 changed files with 1 additions and 1 deletions

View File

@ -362,7 +362,7 @@ impl GcsFilterReader {
} }
/// Fast reduction of hash to [0, nm) range. /// Fast reduction of hash to [0, nm) range.
fn map_to_range(hash: u64, nm: u64) -> u64 { ((hash as u128 * nm as u128) >> 64) as u64 } fn map_to_range(hash: u64, nm: u64) -> u64 { ((u128::from(hash) * u128::from(nm)) >> 64) as u64 }
/// Golomb-Rice encoded filter writer. /// Golomb-Rice encoded filter writer.
pub struct GcsFilterWriter<'a, W> { pub struct GcsFilterWriter<'a, W> {