From 2b768a55052714e53b0a40e8a6e0ab98432b737f Mon Sep 17 00:00:00 2001 From: Igor Katson Date: Sat, 26 Jun 2021 17:32:17 +0100 Subject: [PATCH] Nothing (almost) --- crates/librqbit/src/chunk_tracker.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/librqbit/src/chunk_tracker.rs b/crates/librqbit/src/chunk_tracker.rs index fc682ce..3146181 100644 --- a/crates/librqbit/src/chunk_tracker.rs +++ b/crates/librqbit/src/chunk_tracker.rs @@ -26,9 +26,10 @@ fn compute_chunk_status(lengths: &Lengths, needed_pieces: &BF) -> BF { let chunks_per_piece = lengths .chunks_per_piece(lengths.validate_piece_index(piece_index as u32).unwrap()) as usize; - for i in 0..chunks_per_piece { - chunk_bf.set(offset + i, true); - } + chunk_bf + .get_mut(offset..offset + chunks_per_piece) + .unwrap() + .set_all(true); } chunk_bf }