From b5c48b4898559ea99a5d509c6f446a15df9d3cb5 Mon Sep 17 00:00:00 2001 From: Max Verevkin Date: Sat, 9 Apr 2022 16:11:57 +0300 Subject: [PATCH] fix fmt_tags --- src/main.rs | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/main.rs b/src/main.rs index 78830aa..339eaf6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -287,18 +287,15 @@ fn configuration() -> Flags { } fn fmt_tags(tagmask: u32) { - let mut tag = 0; - let mut current: u32; - while { - current = 1 << tag; - tag == 32 || current <= tagmask - } { - tag += 1; - if current != tagmask && (tagmask / current) % 2 != 0 { - fmt_tags(tagmask - current); - print!(", "); - break; + let mut first = true; + for i in 0..32 { + if tagmask >> i & 1 == 1 { + if !first { + print!(", \"{}\"", i + 1); + } else { + print!("\"{}\"", i + 1); + first = false; + } } } - print!("\"{}\"", tag); }