1
0
Fork 0
forked from nuttx/nuttx-update

For some platorms, need to really use type long constants and types in HTONL and NTOHL

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1571 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2009-03-07 23:27:38 +00:00
parent 8af0d8ce8f
commit 83f444b10f

View file

@ -62,10 +62,15 @@
# define HTONL(nl) (nl)
#else
# define HTONS(ns) \
(uint16)(((((uint16)(ns)) & 0xff) << 8) | ((((uint16)(ns)) >> 8) & 0xff))
(unsigned short) \
(((((unsigned short)(ns)) & 0x00ff) << 8) | \
((((unsigned short)(ns)) >> 8) & 0x00ff))
# define HTONL(nl) \
((((nl) & 0xff) << 24) | (((nl) & 0xff00) << 8) | \
(((nl) & 0xff0000) >> 8) | (((nl) & 0xff000000) >> 24))
(unsigned long) \
(((((unsigned long)(nl)) & 0x000000ffL) << 24) | \
((((unsigned long)(nl)) & 0x0000ff00L) << 8) | \
((((unsigned long)(nl)) & 0x00ff0000L) >> 8) | \
((((unsigned long)(nl)) & 0xff000000L) >> 24))
#endif
#define NTOHS(hs) HTONS(hs)