Re: [PATCH] hid-magicmouse: Correct parsing of large X and Y motions.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2010-07-05 at 16:33 -0400, Michael Poole wrote:
> C99 says that the result of right-shifting a negative value is
> compiler-defined.  gcc documents that it ensures sign extension.  Other
> parts of hid-magicmouse.c use this idiom already.  The corresponding
> idiom in hid-core.c (see the snto32() function) would look something
> like this:
> 
>       x = ((data[3] & 0x0c) << 6) | data[1];
>       x |= (x & (1 << 9)) ? (-1 << 10) : 0;

snto32() seems like something we should be using in hid-magicmouse.c? On
further thought, it actually seems like something that should be a macro
in linux/kernel.h. I would think there could be utility for it in many
places of the kernel.

-- Chase

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux