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 ((BYTE*)ptr)[0] & (1 << 6). > > Another simpler example: > > long a = 0x04030201; > > Big-endian: > ((unsigned char*)&a)[0] == 0x04 > ((unsigned char*)&a)[1] == 0x03 > ((unsigned char*)&a)[2] == 0x02 > ((unsigned char*)&a)[3] == 0x01 > > It's weird because we're used to developing on little-endian ;-) > AFAIK the fact that casting to shorter types "just works" is one of the > reasons why little-endian is used everywhere. > > This wouldn't be a problem if we exclusively used SetBit/BitIsOn everywhere. > But we get the bitmask from the kernel, which uses longs and uses correct > byte > order...
070f30e..4969389 master -> master thanks Cheers, Peter _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
