aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/utils
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2016-03-04 10:15:49 +0100
committerTobias Brunner <tobias@strongswan.org>2016-03-04 18:43:26 +0100
commitfac9fd73689ae34fc29d7be8ba58b384b7a693e4 (patch)
tree3efb7807ebb96930ab7d345f29be0036285b015b /src/libstrongswan/utils
parent14de79604a1b9ab77b7116c247d14f6be3009bdb (diff)
downloadstrongswan-fac9fd73689ae34fc29d7be8ba58b384b7a693e4.tar.bz2
strongswan-fac9fd73689ae34fc29d7be8ba58b384b7a693e4.tar.xz
byteorder: Simplify htoun64/untoh64 functions
Diffstat (limited to 'src/libstrongswan/utils')
-rw-r--r--src/libstrongswan/utils/utils/byteorder.h27
1 files changed, 0 insertions, 27 deletions
diff --git a/src/libstrongswan/utils/utils/byteorder.h b/src/libstrongswan/utils/utils/byteorder.h
index 53ec177a5..c3c0e6704 100644
--- a/src/libstrongswan/utils/utils/byteorder.h
+++ b/src/libstrongswan/utils/utils/byteorder.h
@@ -112,21 +112,8 @@ static inline void htoun64(void *network, u_int64_t host)
{
char *unaligned = (char*)network;
-#ifdef be64toh
host = htobe64(host);
memcpy((char*)unaligned, &host, sizeof(host));
-#else
- u_int32_t high_part, low_part;
-
- high_part = host >> 32;
- high_part = htonl(high_part);
- low_part = host & 0xFFFFFFFFLL;
- low_part = htonl(low_part);
-
- memcpy(unaligned, &high_part, sizeof(high_part));
- unaligned += sizeof(high_part);
- memcpy(unaligned, &low_part, sizeof(low_part));
-#endif
}
/**
@@ -168,24 +155,10 @@ static inline u_int32_t untoh32(void *network)
static inline u_int64_t untoh64(void *network)
{
char *unaligned = (char*)network;
-
-#ifdef be64toh
u_int64_t tmp;
memcpy(&tmp, unaligned, sizeof(tmp));
return be64toh(tmp);
-#else
- u_int32_t high_part, low_part;
-
- memcpy(&high_part, unaligned, sizeof(high_part));
- unaligned += sizeof(high_part);
- memcpy(&low_part, unaligned, sizeof(low_part));
-
- high_part = ntohl(high_part);
- low_part = ntohl(low_part);
-
- return (((u_int64_t)high_part) << 32) + low_part;
-#endif
}
/**