From 39d626848762c3e21b84576ddfe2eec84739efa0 Mon Sep 17 00:00:00 2001 From: Alexander Rosenberg Date: Thu, 2 May 2024 21:53:39 -0700 Subject: [PATCH] Fix populated_tags to handle view on multiple tags --- src/main.rs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/main.rs b/src/main.rs index c7603cb..04fd7f5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -208,18 +208,16 @@ fn handle_river_output_status( tags, } => { if let Some(output) = env.outputs.get_mut(&output_id) { - output.populated_tags = tags[0..] - .chunks(4) - .map(|s| { - let buf = [s[0], s[1], s[2], s[3]]; - let tagmask = u32::from_le_bytes(buf); - for i in 0..32 { - if 1 << i == tagmask { - return 1 + i; - } + output.populated_tags.clear(); + for tag_ind in 0..(tags.len()) { + for bit_ind in 0..=7 { + if tags[tag_ind] & (1 << bit_ind) != 0 { + output.populated_tags.push( + ((tag_ind * 8 + bit_ind + 1) % 32) as u32 + ); } - 0 - }).collect(); + } + } } }, zriver_output_status_v1::Event::UrgentTags {