From 894115ad3db62b7baa5707cc287c9ab251acc2a7 Mon Sep 17 00:00:00 2001 From: Franklin Wei Date: Sun, 21 Jul 2024 04:36:30 -0400 Subject: [PATCH] Add STRIP_BUTTON_MODIFIERS() macro to refactor modifier flag stripping. There are many places in the code which use the (x & ~MOD_MASK) idiom. This new macro makes possible their refactoring in the future. --- puzzles.h | 1 + 1 file changed, 1 insertion(+) diff --git a/puzzles.h b/puzzles.h index f545653..b560b78 100644 --- a/puzzles.h +++ b/puzzles.h @@ -72,6 +72,7 @@ enum { (m) == CURSOR_RIGHT || (m) == CURSOR_LEFT ) #define IS_CURSOR_SELECT(m) ( (m) == CURSOR_SELECT || (m) == CURSOR_SELECT2) #define IS_UI_FAKE_KEY(m) ( (m) > UI_LOWER_BOUND && (m) < UI_UPPER_BOUND ) +#define STRIP_BUTTON_MODIFIERS(m) ( (unsigned)(m) & ~MOD_MASK ) /* * Flags in the back end's `flags' word.