diff --git a/sub_crates/sobol/src/lib.rs b/sub_crates/sobol/src/lib.rs index 64ca5ec..a940f9d 100644 --- a/sub_crates/sobol/src/lib.rs +++ b/sub_crates/sobol/src/lib.rs @@ -69,7 +69,7 @@ fn lk_scramble(mut n: u32, scramble: u32) -> u32 { n = n.wrapping_add(n << 2); n ^= n.wrapping_mul(0xfe9b5742); n = n.wrapping_add(scramble); - n = n.wrapping_mul(scramble | 1); + n = n.wrapping_mul((scramble >> 16) | 1); n } @@ -82,7 +82,7 @@ fn lk_scramble_int4(mut n: Int4, scramble: u32) -> Int4 { n += n << 2; n ^= n * [0xfe9b5742; 4].into(); n += scramble; - n *= scramble | [1; 4].into(); + n *= (scramble >> 16) | [1; 4].into(); n } diff --git a/sub_crates/sobol/src/wide.rs b/sub_crates/sobol/src/wide.rs index e112cc9..2e05234 100644 --- a/sub_crates/sobol/src/wide.rs +++ b/sub_crates/sobol/src/wide.rs @@ -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) }; n[i] }