Use endian.h naming instead of inet.h
Make it explicit that network order is big endian and that short, long
and long long are 16, 32 and 64-bit values, respectively.
Change-Id: I52f23e43d16111852dc691a3e7d89659e0ada233
diff --git a/inc/std.h b/inc/std.h
index d2438a2..caed9dd 100644
--- a/inc/std.h
+++ b/inc/std.h
@@ -12,12 +12,12 @@
size_t strlen(const char *str);
int strcmp(const char *a, const char *b);
-static inline uint16_t ntohs(uint16_t v)
+static inline uint16_t be16toh(uint16_t v)
{
return v << 8 | v >> 8;
}
-static inline uint32_t ntohl(uint32_t v)
+static inline uint32_t be32toh(uint32_t v)
{
/* TODO: no conversion needed if native is big endian. */
return (v << 24) |
@@ -26,7 +26,7 @@
((v & 0xff0000) >> 8);
}
-static inline uint64_t ntohll(uint64_t v)
+static inline uint64_t be64toh(uint64_t v)
{
/* TODO: no conversion needed if native is big endian. */
return (v << 56) |
@@ -39,14 +39,14 @@
((v & 0xff00000000) >> 8);
}
-static inline uint32_t htonl(uint32_t v)
+static inline uint32_t htobe32(uint32_t v)
{
- return ntohl(v);
+ return be32toh(v);
}
-static inline uint64_t htonll(uint64_t v)
+static inline uint64_t htobe64(uint64_t v)
{
- return ntohll(v);
+ return be64toh(v);
}
#endif /* STD_H */