[PATCH 1/3] dix: use BitIsOn/SetBit/ClearBit macros for set_key_down helpers.
Peter Hutterer
peter.hutterer at who-t.net
Mon Jul 5 16:30:08 PDT 2010
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
dix/getevents.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/dix/getevents.c b/dix/getevents.c
index 2eacdfe..1d505e5 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -94,18 +94,18 @@ void
set_key_down(DeviceIntPtr pDev, int key_code, int type)
{
if (type == KEY_PROCESSED)
- pDev->key->down[key_code >> 3] |= (1 << (key_code & 7));
+ SetBit(pDev->key->down, key_code);
else
- pDev->key->postdown[key_code >> 3] |= (1 << (key_code & 7));
+ SetBit(pDev->key->postdown, key_code);
}
void
set_key_up(DeviceIntPtr pDev, int key_code, int type)
{
if (type == KEY_PROCESSED)
- pDev->key->down[key_code >> 3] &= ~(1 << (key_code & 7));
+ ClearBit(pDev->key->down, key_code);
else
- pDev->key->postdown[key_code >> 3] &= ~(1 << (key_code & 7));
+ ClearBit(pDev->key->postdown, key_code);
}
Bool
@@ -114,9 +114,9 @@ key_is_down(DeviceIntPtr pDev, int key_code, int type)
int ret = 0;
if (type & KEY_PROCESSED)
- ret |= !!(pDev->key->down[key_code >> 3] & (1 << (key_code & 7)));
+ ret |= !!BitIsOn(pDev->key->down, key_code);
if (type & KEY_POSTED)
- ret |= !!(pDev->key->postdown[key_code >> 3] & (1 << (key_code & 7)));
+ ret |= !!BitIsOn(pDev->key->postdown, key_code);
return ret;
}
--
1.7.1
More information about the xorg-devel
mailing list