mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-04 09:20:29 +01:00
touchpad: use ffs instead of a manual count
BTN_TOOL_FINGER, DOUBLETAP, etc. are mutually exclusive in the kernel, so we can use ffs here instead of manually counting. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
99cb908722
commit
dc3d9315fe
1 changed files with 1 additions and 10 deletions
|
|
@ -138,17 +138,8 @@ 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, nfake_touches;
|
||||
|
||||
/* don't count BTN_TOUCH */
|
||||
fake_touches = tp->fake_touches >> 1;
|
||||
nfake_touches = 0;
|
||||
while (fake_touches) {
|
||||
nfake_touches++;
|
||||
fake_touches >>= 1;
|
||||
}
|
||||
|
||||
return nfake_touches;
|
||||
return ffs(tp->fake_touches >> 1);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue