From 8b309fbeaab6e327ec96a1fbf1a90e739c2bfd6c Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 28 Sep 2014 17:07:44 +0200 Subject: [PATCH] Move clear_bit/get_bit/set_bit to input_common.h --- input/android_input.c | 15 --------------- input/input_common.h | 15 +++++++++++++++ input/udev_input.c | 15 --------------- 3 files changed, 15 insertions(+), 30 deletions(-) diff --git a/input/android_input.c b/input/android_input.c index 0f27ad00e4..7fa626895f 100644 --- a/input/android_input.c +++ b/input/android_input.c @@ -100,21 +100,6 @@ static typeof(AMotionEvent_getAxisValue) *p_AMotionEvent_getAxisValue; #define AMotionEvent_getAxisValue (*p_AMotionEvent_getAxisValue) -static inline bool get_bit(const uint8_t *buf, unsigned bit) -{ - return buf[bit >> 3] & (1 << (bit & 7)); -} - -static inline void clear_bit(uint8_t *buf, unsigned bit) -{ - buf[bit >> 3] &= ~(1 << (bit & 7)); -} - -static inline void set_bit(uint8_t *buf, unsigned bit) -{ - buf[bit >> 3] |= 1 << (bit & 7); -} - static void engine_handle_dpad_default(android_input_t *android, AInputEvent *event, int port, int source) { diff --git a/input/input_common.h b/input/input_common.h index 2706d828f1..052f7da376 100644 --- a/input/input_common.h +++ b/input/input_common.h @@ -54,6 +54,21 @@ static inline void input_conv_analog_id_to_bind_id(unsigned index, unsigned id, } } +static inline bool get_bit(const uint8_t *buf, unsigned bit) +{ + return buf[bit >> 3] & (1 << (bit & 7)); +} + +static inline void clear_bit(uint8_t *buf, unsigned bit) +{ + buf[bit >> 3] &= ~(1 << (bit & 7)); +} + +static inline void set_bit(uint8_t *buf, unsigned bit) +{ + buf[bit >> 3] |= 1 << (bit & 7); +} + bool input_translate_coord_viewport(int mouse_x, int mouse_y, int16_t *res_x, int16_t *res_y, int16_t *res_screen_x, int16_t *res_screen_y); diff --git a/input/udev_input.c b/input/udev_input.c index 78c055b100..b8c5f88e20 100644 --- a/input/udev_input.c +++ b/input/udev_input.c @@ -101,21 +101,6 @@ struct udev_input bool mouse_l, mouse_r, mouse_m, mouse_wu, mouse_wd; }; -static inline bool get_bit(const uint8_t *buf, unsigned bit) -{ - return buf[bit >> 3] & (1 << (bit & 7)); -} - -static inline void clear_bit(uint8_t *buf, unsigned bit) -{ - buf[bit >> 3] &= ~(1 << (bit & 7)); -} - -static inline void set_bit(uint8_t *buf, unsigned bit) -{ - buf[bit >> 3] |= 1 << (bit & 7); -} - #ifdef HAVE_XKBCOMMON // FIXME: Don't handle composed and dead-keys properly. Waiting for support in libxkbcommon ... static void handle_xkb(udev_input_t *udev, int code, int value)