From 65fc53eace19392426631ba2f5bcbd9aec88d796 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Wed, 25 Sep 2024 22:39:22 +0200 Subject: [PATCH] Simplify (and inline) is_shortcut_mod() Masking was unnecessary (im->sdl_shortcut_mods is implicitly masked). PR #5322 --- app/src/input_manager.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/input_manager.c b/app/src/input_manager.c index 444a5f16..0f121da9 100644 --- a/app/src/input_manager.c +++ b/app/src/input_manager.c @@ -33,10 +33,10 @@ to_sdl_mod(uint8_t shortcut_mod) { return sdl_mod; } -static bool +static inline bool is_shortcut_mod(struct sc_input_manager *im, uint16_t sdl_mod) { - // keep only the relevant modifier keys - sdl_mod &= SC_SDL_SHORTCUT_MODS_MASK; + // im->sdl_shortcut_mods is within the mask + assert(!(im->sdl_shortcut_mods & ~SC_SDL_SHORTCUT_MODS_MASK)); // at least one shortcut mod pressed? return sdl_mod & im->sdl_shortcut_mods;