mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-04 05:50:26 +01:00
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 <mforney@mforney.org>
This commit is contained in:
parent
7160db054a
commit
39c0d633f7
1 changed files with 4 additions and 2 deletions
|
|
@ -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))
|
||||
evdev_log_bug_kernel(tp->device,
|
||||
"Invalid fake finger state %#x\n",
|
||||
tp->fake_touches);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue