diff options
Diffstat (limited to 'src/Endianness.h')
-rw-r--r-- | src/Endianness.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/Endianness.h b/src/Endianness.h index 78f9a5d99..9aeb44986 100644 --- a/src/Endianness.h +++ b/src/Endianness.h @@ -1,6 +1,7 @@ #pragma once +#undef ntohll #define ntohll(x) ((((UInt64)ntohl((u_long)x)) << 32) + ntohl(x >> 32)) @@ -11,8 +12,8 @@ inline UInt64 HostToNetwork8(const void * a_Value) { unsigned long long __HostToNetwork8; - memcpy( &__HostToNetwork8, a_Value, sizeof( __HostToNetwork8 ) ); - __HostToNetwork8 = (( ( (unsigned long long)htonl((u_long)__HostToNetwork8) ) << 32) + htonl(__HostToNetwork8 >> 32)); + memcpy( &__HostToNetwork8, a_Value, sizeof( __HostToNetwork8)); + __HostToNetwork8 = (( ( (unsigned long long)htonl((u_long)__HostToNetwork8)) << 32) + htonl(__HostToNetwork8 >> 32)); return __HostToNetwork8; } @@ -20,11 +21,11 @@ inline UInt64 HostToNetwork8(const void * a_Value) -inline UInt32 HostToNetwork4(const void* a_Value ) +inline UInt32 HostToNetwork4(const void* a_Value) { unsigned int __HostToNetwork4; - memcpy( &__HostToNetwork4, a_Value, sizeof( __HostToNetwork4 ) ); - __HostToNetwork4 = ntohl( __HostToNetwork4 ); + memcpy( &__HostToNetwork4, a_Value, sizeof( __HostToNetwork4)); + __HostToNetwork4 = ntohl( __HostToNetwork4); return __HostToNetwork4; } |