Gilbert Ramirez Jr. wrote:
> I don't think you messed them up; I think I might have put them in
> incorrectly. The following program shows that the big-endian/little-endian
> test in packet.h is backwards.
>
Yes, a correct definition maybe (without the correct gtk types, but
casts are important) :
#if BYTE_ORDER == LITTLE_ENDIAN
#define pntohs(p) ((u_short) \
((u_short)*((u_char *)p+0)<<8| \
(u_short)*((u_char *)p+1)<<0))
#define pntohl(p) ((u_long)*((u_char *)p+0)<<24| \
(u_long)*((u_char *)p+1)<<16| \
(u_long)*((u_char *)p+2)<<8| \
(u_long)*((u_char *)p+3)<<0)
#else
#define pntohs(p) ((u_short) \
((u_short)*((u_char *)p+1)<<8| \
(u_short)*((u_char *)p+0)<<0))
#define pntohl(p) ((u_long)*((u_char *)p+3)<<24| \
(u_long)*((u_char *)p+2)<<16| \
(u_long)*((u_char *)p+1)<<8| \
(u_long)*((u_char *)p+0)<<0)
#endif /* LITTLE_ENDIAN */
Laurent.
--
Laurent DENIEL | E-mail: deniel@xxxxxxxxxxx
Paris, FRANCE | deniel@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
| WWW : http://www.worldnet.fr/~deniel
All above opinions are personal, unless stated otherwise.