mbed OS5

Fork of UIPEthernet by Zoltan Hudak

Revision:
8:4acb22344932
Parent:
4:d774541a34da
--- a/utility/util.h	Tue Apr 26 18:37:14 2016 +0000
+++ b/utility/util.h	Fri Jun 30 19:51:28 2017 +0000
@@ -1,9 +1,8 @@
 #ifndef UTIL_H
-    #define UTIL_H
+#define UTIL_H
 
-    #define htons(x)    (((x) << 8) | (((x) >> 8) & 0xFF))
-    #define ntohs(x)    htons(x)
-    #define htonl(x) \
-        (((x) << 24 & 0xFF000000UL) | ((x) << 8 & 0x00FF0000UL) | ((x) >> 8 & 0x0000FF00UL) | ((x) >> 24 & 0x000000FFUL))
-    #define ntohl(x)    htonl(x)
+#define htons(x)    (u16_t) ((((u16_t) (x)) << 8) | (((u16_t) (x)) >> 8))
+//#define ntohs(x)    htons(x)
+#define htonl(x)    (((x) << 24 & 0xFF000000UL) | ((x) << 8 & 0x00FF0000UL) | ((x) >> 8 & 0x0000FF00UL) | ((x) >> 24 & 0x000000FFUL))
+#define ntohl(x)    htonl(x)
 #endif