From 5ab1a51f4c82792813f2937e67cf806c85ee18b5 Mon Sep 17 00:00:00 2001 From: Nathan Vegdahl Date: Fri, 12 May 2017 00:34:03 -0700 Subject: [PATCH] Avoid bounds checking in the Sobol code. --- sub_crates/sobol/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sub_crates/sobol/src/lib.rs b/sub_crates/sobol/src/lib.rs index b11b0ab..f968cd0 100644 --- a/sub_crates/sobol/src/lib.rs +++ b/sub_crates/sobol/src/lib.rs @@ -38,7 +38,7 @@ pub fn sample_with_scramble(dimension: u32, mut index: u32, scramble: u32) -> f3 let mut i = (dimension as usize) * SIZE; while index != 0 { if (index & 1) != 0 { - result ^= MATRICES[i]; + result ^= unsafe { *MATRICES.get_unchecked(i) }; } index >>= 1;