diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2009-03-07 23:27:38 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2009-03-07 23:27:38 +0000 |
commit | 4179c3f4fbbb2b1551386cba35c4cd2d46a9386b (patch) | |
tree | 07de9dfe38eb533918cf867c9387ca12196008e6 /nuttx/include | |
parent | 6122227fd0e93b3cf13aae5c98104b921a34611a (diff) | |
download | px4-nuttx-4179c3f4fbbb2b1551386cba35c4cd2d46a9386b.tar.gz px4-nuttx-4179c3f4fbbb2b1551386cba35c4cd2d46a9386b.tar.bz2 px4-nuttx-4179c3f4fbbb2b1551386cba35c4cd2d46a9386b.zip |
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
Diffstat (limited to 'nuttx/include')
-rw-r--r-- | nuttx/include/arpa/inet.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/nuttx/include/arpa/inet.h b/nuttx/include/arpa/inet.h index 15871ef3c..e2f4d2c0d 100644 --- a/nuttx/include/arpa/inet.h +++ b/nuttx/include/arpa/inet.h @@ -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) |