nanogui: Cross-compilation of microwindows
Subject:
Re: [nanogui] Cross-compilation of microwindows
From:
Peter Barada ####@####.####
Date:
25 Aug 2005 15:09:25 +0100
Message-Id: <20050825140919.D856F98428@baradas.org>
>: Then it looks like
>: only the code in nxproto.c(I think) has to be hacked up to put the
>: data into the order the server wants.
>:
>: I'd suggest that we create a set of 'ctos' ordering macros for "client
>: to server" byteorder that refer to a global that holds the server's
>: byteorder, something like:
>
>Hmm.. Overall, I'm definitely not in favor of dirtying up
>all the code trying to get the network writes all in the right
>byte order, when almost nobody will use the feature.
Its in the client functions that know how to lay out the request
structure, so they are the logical place to put in swap macros(or
inline function calls, etc). I've started to put them into the code
as I need them, using something like:
extern int require_byte_swap; // !0 if first short back from
// server is not 0x0001
static inline unsigned short ctoss(unsigned short x)
{
if (require_byte_swap)
return (((x & 0x00ff) >> 8) | ((x & 0xff00) << 8));
else
return x;
}
Then in a case where you *never* need to swap(as defined by a config
option), the definition could change to:
static inline unsigned short ctoss(unsigned short x)
{
return x;
}
And the generated code should stay the same as if didn't have any byte
swapping code in it.
--
Peter Barada
####@####.####