Fixed an issue with the Owen scramble hash.
Thanks to a tip from Matt Pharr.
This commit is contained in:
parent
f9deb9afb6
commit
87859f5258
|
@ -69,7 +69,7 @@ fn lk_scramble(mut n: u32, scramble: u32) -> u32 {
|
||||||
n = n.wrapping_add(n << 2);
|
n = n.wrapping_add(n << 2);
|
||||||
n ^= n.wrapping_mul(0xfe9b5742);
|
n ^= n.wrapping_mul(0xfe9b5742);
|
||||||
n = n.wrapping_add(scramble);
|
n = n.wrapping_add(scramble);
|
||||||
n = n.wrapping_mul(scramble | 1);
|
n = n.wrapping_mul((scramble >> 16) | 1);
|
||||||
|
|
||||||
n
|
n
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ fn lk_scramble_int4(mut n: Int4, scramble: u32) -> Int4 {
|
||||||
n += n << 2;
|
n += n << 2;
|
||||||
n ^= n * [0xfe9b5742; 4].into();
|
n ^= n * [0xfe9b5742; 4].into();
|
||||||
n += scramble;
|
n += scramble;
|
||||||
n *= scramble | [1; 4].into();
|
n *= (scramble >> 16) | [1; 4].into();
|
||||||
|
|
||||||
n
|
n
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,9 @@ pub(crate) mod sse {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get(self, i: usize) -> u32 {
|
/// For testing.
|
||||||
|
#[allow(dead_code)]
|
||||||
|
fn get(self, i: usize) -> u32 {
|
||||||
let n: [u32; 4] = unsafe { std::mem::transmute(self) };
|
let n: [u32; 4] = unsafe { std::mem::transmute(self) };
|
||||||
n[i]
|
n[i]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user