Skip to content

Commit

Permalink
fix clippy
Browse files Browse the repository at this point in the history
Signed-off-by: zenghua <[email protected]>
  • Loading branch information
zenghua committed Jan 5, 2024
1 parent 0738e5e commit 311f822
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions rust/lakesoul-io/src/hash_utils/spark_murmur3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,8 @@ pub fn spark_murmur3_32_for_bytes<T: Read>(source: &mut T, seed: u32) -> Result<
0 => return Ok(finish(state, processed)),
n if n < 4 => {
processed += n as u32;
for i in 0..n {
let k = buffer[i] as u32;
state ^= calc_k(k);
for k in buffer.iter().take(n) {
state ^= calc_k(*k as u32);
state = state.rotate_left(R2);
state = (state.wrapping_mul(M)).wrapping_add(N);
}
Expand All @@ -70,7 +69,7 @@ pub fn spark_murmur3_32_for_bytes<T: Read>(source: &mut T, seed: u32) -> Result<

fn finish(state: u32, processed: u32) -> u32 {
let mut hash = state;
hash ^= processed as u32;
hash ^= processed;
hash ^= hash.wrapping_shr(R1);
hash = hash.wrapping_mul(C1);
hash ^= hash.wrapping_shr(R2);
Expand Down

0 comments on commit 311f822

Please sign in to comment.