mirror of
https://github.com/cberner/raptorq.git
synced 2024-06-27 09:19:02 +00:00
Reduce calls to rand() during HDPC generation
Small improvement to performance. Perhaps 1%
This commit is contained in:
parent
6546b714ad
commit
f36bf73ca9
@ -66,16 +66,17 @@ fn generate_hdpc_rows(Kprime: usize, S: usize, H: usize) -> DenseOctetMatrix {
|
||||
let mut mt: Vec<Vec<u8>> = vec![vec![0; Kprime + S]; H];
|
||||
#[allow(clippy::needless_range_loop)]
|
||||
for i in 0..H {
|
||||
#[allow(clippy::needless_range_loop)]
|
||||
for j in 0..=(Kprime + S - 2) {
|
||||
let rand6 = rand((j + 1) as u32, 6u32, H as u32) as usize;
|
||||
let rand7 = rand((j + 1) as u32, 7u32, (H - 1) as u32) as usize;
|
||||
if i == rand6 || i == (rand6 + rand7 + 1) % H {
|
||||
mt[i][j] = 1;
|
||||
}
|
||||
}
|
||||
mt[i][Kprime + S - 1] = Octet::alpha(i).byte();
|
||||
}
|
||||
#[allow(clippy::needless_range_loop)]
|
||||
for j in 0..=(Kprime + S - 2) {
|
||||
let rand6 = rand((j + 1) as u32, 6u32, H as u32) as usize;
|
||||
let rand7 = rand((j + 1) as u32, 7u32, (H - 1) as u32) as usize;
|
||||
let i1 = rand6;
|
||||
let i2 = (rand6 + rand7 + 1) % H;
|
||||
mt[i1][j] = 1;
|
||||
mt[i2][j] = 1;
|
||||
}
|
||||
// Multiply by the GAMMA matrix
|
||||
// See section 5.3.3.3
|
||||
let mut gamma_row = vec![0; Kprime + S];
|
||||
|
Loading…
Reference in New Issue
Block a user