Move clear_bit/get_bit/set_bit to input_common.h

This commit is contained in:
twinaphex 2014-09-28 17:07:44 +02:00
parent 9edb88caba
commit 8b309fbeaa
3 changed files with 15 additions and 30 deletions

View File

@ -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)
{

View File

@ -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);

View File

@ -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)