From 03a9e8803e893a73bd6a1e86819af7ff0f2a33eb Mon Sep 17 00:00:00 2001 From: Cesar Eduardo Barros Date: Tue, 17 Jan 2017 20:08:20 -0200 Subject: [PATCH] Elide bounds checks --- src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index dd92287..356c7c1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -246,6 +246,7 @@ macro_rules! ct_eq_slice_gen { if x_len != y_len { return false; } + let y = &y[..x_len]; // elide bounds checks; see Rust commit 6a7bc47 let mut flag: $code = 0; for i in 0..x_len { flag |= x[i] ^ y[i]; @@ -352,6 +353,7 @@ macro_rules! ct_constant_copy_gen { if x_len != y_len { panic!("Consistent Time: Attempted to copy between non-equal lens"); } + let y = &y[..x_len]; // elide bounds checks; see Rust commit 6a7bc47 for i in 0..x_len { let y_temp = y[i].clone(); let x_temp = x[i].clone();