Commit 39c0d633 authored by Michael Forney's avatar Michael Forney

Use bitwise test instead of __builtin_popcount

__builtin_popcount might not be available on all compilers, so using
it requires a configure check and fallback implementation. In fact
on gcc without an -march flag, it gets compiled to a function call to
libgcc. However, we only need to test whether multiple bits are set,
and this can be done easily with a bitwise and.
Signed-off-by: Michael Forney's avatarMichael Forney <>
parent 7160db05
......@@ -245,10 +245,12 @@ tp_get_touch(struct tp_dispatch *tp, unsigned int slot)
static inline unsigned int
tp_fake_finger_count(struct tp_dispatch *tp)
unsigned int fake_touches =
tp->fake_touches & ~(FAKE_FINGER_OVERFLOW|0x1);
/* Only one of BTN_TOOL_DOUBLETAP/TRIPLETAP/... may be set at any
* time */
if (__builtin_popcount(
tp->fake_touches & ~(FAKE_FINGER_OVERFLOW|0x1)) > 1)
if (fake_touches & (fake_touches - 1))
"Invalid fake finger state %#x\n",
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment