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/src/main.c b/src/main.c
index 946dceb..d5c2c22 100644
--- a/src/main.c
+++ b/src/main.c
@@ -31,10 +31,10 @@
switch (size) {
case sizeof(uint32_t):
- return ntohl(*(uint32_t *)data);
+ return be32toh(*(uint32_t *)data);
case sizeof(uint64_t):
memcpy(t.a, data, sizeof(uint64_t));
- return ntohll(t.v);
+ return be64toh(t.v);
default:
return 0;
}
@@ -76,11 +76,11 @@
switch (size) {
case sizeof(uint32_t):
- *(uint32_t *)data = ntohl(value);
+ *(uint32_t *)data = be32toh(value);
break;
case sizeof(uint64_t):
- t.v = ntohll(value);
+ t.v = be64toh(value);
memcpy((void *)data, t.a, sizeof(uint64_t));
break;