]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - support/sdk/c/blip/lib6lowpan/lib6lowpan.h
- remove automake-generated files
[tinyos-2.x.git] / support / sdk / c / blip / lib6lowpan / lib6lowpan.h
index 4596ac960abde51afc1184f856a9f0b94dd640b2..0278c554a6dea787aaf5d5050e4be1cd3671a415 100644 (file)
 
 #include "6lowpan.h"
 #include "ip.h"
-
-#if defined(PC) || defined(__TARGET_mips__)
-// use library versions if on linux
-#include <netinet/in.h>
-#define ntoh16(X)   ntohs(X)
-#define hton16(X)   htons(X)
-#define ntoh32(X)   ntohl(X)
-#define hton32(X)   htonl(X)
-
-#if defined(PC)
-#define leton16(X)  hton16(X)
-#ifndef htole16
-#define htole16(X)  (X)
-#endif
-#else
-#define leton16(X)  (((((uint16_t)(X)) << 8) | ((uint16_t)(X) >> 8)) & 0xffff)
-#define htole16(X)  leton16(X)
-#endif
-
-#else 
-// otherwise have to provide our own 
-
-#define leton16(X)  hton16(X)
-#ifndef htole16
-#define htole16(X)  (X)
-#endif
-
-#define ntoh16(X)   (((((uint16_t)(X)) >> 8) | ((uint16_t)(X) << 8)) & 0xffff)
-#define hton16(X)   (((((uint16_t)(X)) << 8) | ((uint16_t)(X) >> 8)) & 0xffff)
-
-/* this is much more efficient since gcc can insert swpb now.  */
-static uint32_t __attribute__((unused))  ntoh32(uint32_t i) {
-  uint16_t lo = (uint16_t)i;
-  uint16_t hi = (uint16_t)(i >> 16);
-  lo = (lo << 8) | (lo >> 8);
-  hi = (hi << 8) | (hi >> 8);
-  return (((uint32_t)lo) << 16) | ((uint32_t)hi);
-}                                                                                                                      
-#define hton32(X) ntoh32(X)
-
-#define ntohs(X) ntoh16(X)
-#define htons(X) hton16(X)
-#define ntohl(X) ntoh32(X)
-#define htonl(X) hton32(X)
-
-#endif
+#include "nwbyte.h"
 
 
 #ifdef DEF_MEMCPY