Re: Re: Re: [PATCH evdev] type-safe inline functions for bitmask manipulation

2011-10-24 Thread Peter Hutterer
On Wed, Oct 19, 2011 at 09:34:47AM +0200, Max Schwarz wrote: EvdevBitIsSet(array, KEY_A):array[0] (1 30) BitIsOn(ptr, KEY_A):((BYTE*)ptr)[3] (1 6) That is true on little-endian. Big-endian machines have that byte in position 0, so that one would need to be

Re: Re: Re: [PATCH evdev] type-safe inline functions for bitmask manipulation

2011-10-19 Thread Max Schwarz
EvdevBitIsSet(array, KEY_A):array[0] (1 30) BitIsOn(ptr, KEY_A):((BYTE*)ptr)[3] (1 6) That is true on little-endian. Big-endian machines have that byte in position 0, so that one would need to be ((BYTE*)ptr)[0] (1 6). Another simpler example: long a = 0x04030201;

Re: Re: [PATCH evdev] type-safe inline functions for bitmask manipulation

2011-10-17 Thread Max Schwarz
Have you looked into switching the evdev bit arrays from longs to bytes so we can standardize on one type of bit array? That would be possible. Longs are used because the linux evdev layer uses longs and we can let ioctl() write directly into our bitmask arrays. I can change the occurences of