diff options
Diffstat (limited to 'src/solvers/gpu/output.rs')
-rw-r--r-- | src/solvers/gpu/output.rs | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/solvers/gpu/output.rs b/src/solvers/gpu/output.rs index a716340..b35d072 100644 --- a/src/solvers/gpu/output.rs +++ b/src/solvers/gpu/output.rs @@ -26,14 +26,20 @@ impl InBuffer { { Message::ResultMessage(results) => { if let Some(result_walls) = self.row_requests.get(&results.id) { - return Some(Self::calc_results(results.valid_walls(), result_walls)); + return Some(Self::calc_results( + results.valid_walls().as_ref(), + result_walls, + )); } else { self.results_requests.insert(results.id, results); } } Message::OutputMessage((id, output)) => { if let Some(results) = self.results_requests.get(&id) { - return Some(Self::calc_results(results.valid_walls(), output.as_ref())); + return Some(Self::calc_results( + results.valid_walls().as_ref(), + output.as_ref(), + )); } else { self.row_requests.insert(id, output); } @@ -48,10 +54,10 @@ impl InBuffer { } } fn calc_results(res_req: &[Vec<u32>], row_req: &[Vec<u32>]) -> Vec<RowResult> { - let out = Vec::new(); + let mut out = Vec::new(); for (rows, perms) in row_req.iter().zip(res_req.iter()) { for p in perms { - let new = rows.clone(); + let mut new = rows.clone(); new.push(*p); out.push(RowResult::new(new)); } @@ -66,7 +72,7 @@ pub struct RowResult { } impl RowResult { - fn new(rows: Vec<u32>) -> Self { + fn new(mut rows: Vec<u32>) -> Self { rows.push(0); Self { rows } } @@ -117,6 +123,7 @@ impl Output { for wall in self.results { wall.output() } + return; } } } |