mirror of
https://github.com/cberner/raptorq.git
synced 2024-06-20 22:08:51 +00:00
Avoid bounds checking in loop
Slicing `src` checks bounds only once instead of on every iteration of loop.
This commit is contained in:
parent
4bf46ec16b
commit
4a6ddf1c26
@ -1,6 +1,7 @@
|
||||
pub fn add_assign_binary(dest: &mut [u64], src: &[u64]) {
|
||||
for i in 0..dest.len() {
|
||||
let len = dest.len();
|
||||
for (dest, &src) in dest.iter_mut().zip(&src[..len]) {
|
||||
// Addition over GF(2) is defined as XOR
|
||||
dest[i] ^= src[i];
|
||||
*dest ^= src;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user