From 1e2139a3e487494f4ed4779e0c013cfcc3b4c41d Mon Sep 17 00:00:00 2001 From: relrelb Date: Fri, 21 Apr 2023 17:02:08 +0300 Subject: [PATCH] core: Use `BitFlags::iter` Instead of manually shifting bits. --- core/src/display_object/avm1_button.rs | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/core/src/display_object/avm1_button.rs b/core/src/display_object/avm1_button.rs index 8463e0b02..bb5bcc6f7 100644 --- a/core/src/display_object/avm1_button.rs +++ b/core/src/display_object/avm1_button.rs @@ -56,18 +56,11 @@ impl<'gc> Avm1Button<'gc> { let mut actions = vec![]; for action in &button.actions { let action_data = source_movie.to_unbounded_subslice(action.action_data); - let bits = action.conditions.bits(); - let mut bit = 1u16; - while bits & !(bit - 1) != 0 { - if bits & bit != 0 { - actions.push(ButtonAction { - action_data: action_data.clone(), - condition: ButtonActionCondition::from_bits_truncate(bit), - key_code: action.key_code.and_then(ButtonKeyCode::from_u8), - }); - } - bit <<= 1; - } + actions.extend(action.conditions.into_iter().map(|condition| ButtonAction { + action_data: action_data.clone(), + condition, + key_code: action.key_code.and_then(ButtonKeyCode::from_u8), + })); } let static_data = ButtonStatic {