zip to copy results

This commit is contained in:
Henry Schimke
2023-01-10 09:34:41 -06:00
parent 4bd2e53a5c
commit 149dc260c9

View File

@@ -215,9 +215,9 @@ fn correctErrors(codewordBytes: &mut [u8], numDataCodewords: usize) -> Result<()
// Copy back into array of bytes -- only need to worry about the bytes that were data
// We don't care about errors in the error-correction codewords
for i in 0..numDataCodewords {
// for (int i = 0; i < numDataCodewords; i++) {
codewordBytes[i] = sending_code_words[i] as u8;
for (code_word, sent_code_word ) in codewordBytes.iter_mut().zip(sending_code_words.iter()).take(numDataCodewords){
*code_word = *sent_code_word as u8;
}
Ok(())
}