On Sun, 5 Jan 2003, Andreas Beck wrote: > Well I have a general idea, though nothing specific: You were using 32 bit > modes, right? In that case, you might have BGRX vs. XRGB in the color > schemes. > > This leads to sending B=ff G=ff R=ff X=00 for white, which gets interpreted > as X=ff R=ff G=ff B=00 which is yellow.
This problem is common in the entire communication world. The solution is by defining the communication channel X-endian and converting all data that is sent over that channel to X-endian. I use X here, for it doesn't matter if it is big endian, little endian, byte swapped, whatever. All you have to take into account is that you might want to have the group of machines that can handle the conversion as a NOP as big as possible, so using little endian (Intel, Alpha) means no speed loss for most of the target machines. For examples of this matter, see the networking layer. #include <netinet/in.h> htonl (host to network long), ntohl (...) htons (host to network short), ntohs (...) htonl converts a long in Host endian to Network endian. In any decent networking code you'll see the use of these very much. Jos