summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2012-05-21 11:40:17 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2012-05-31 14:56:47 +1000
commit6df06f729d9f42fe77e5ff6d9d92089af22f4f37 (patch)
tree4f56b174130b23e94821622ec9896396e0a7bf24
parent70347f20940550765c8a438185b67f9eabf9950e (diff)
Define our own BIT_IS_ON for char arrays
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--src/eventcomm.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/eventcomm.c b/src/eventcomm.c
index 9192a51..a099cb3 100644
--- a/src/eventcomm.c
+++ b/src/eventcomm.c
@@ -50,11 +50,14 @@
#endif
#define SYSCALL(call) while (((call) == -1) && (errno == EINTR))
+/* for char arrays */
+#define BIT_IS_ON(ptr, bit) (!!(((const char *) (ptr))[(bit)>>3] & (1 << ((bit) & 7))))
#define LONG_BITS (sizeof(long) * 8)
#define NBITS(x) (((x) + LONG_BITS - 1) / LONG_BITS)
#define OFF(x) ((x) % LONG_BITS)
#define LONG(x) ((x) / LONG_BITS)
+/* for long arrays */
#define TEST_BIT(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1)
/**
@@ -730,13 +733,13 @@ event_query_touch(SynapticsPrivate *priv, int fd)
#ifdef EVIOCGPROP
SYSCALL(rc = ioctl(fd, EVIOCGPROP(sizeof(prop)), &prop));
- if (rc >= 0 && BitIsOn(&prop, INPUT_PROP_SEMI_MT)) {
+ if (rc >= 0 && BIT_IS_ON(&prop, INPUT_PROP_SEMI_MT)) {
SynapticsMsg(priv, MSG_INFO,
"ignoring touch events for semi-multitouch device\n");
priv->has_semi_mt = TRUE;
}
- if (rc >= 0 && BitIsOn(&prop, INPUT_PROP_BUTTONPAD)) {
+ if (rc >= 0 && BIT_IS_ON(&prop, INPUT_PROP_BUTTONPAD)) {
SynapticsMsg(priv, MSG_INFO, "found clickpad property\n");
para->clickpad = TRUE;
}