1
0

Merge pull request #1817 from bibo38/bugfix1715

Changed Variable types of Endianness.h to uniform UInt* types
This commit is contained in:
worktycho 2015-03-17 20:42:13 +00:00
commit 29e267cac0

View File

@ -2,7 +2,7 @@
#pragma once #pragma once
#undef ntohll #undef ntohll
#define ntohll(x) ((((UInt64)ntohl((u_long)x)) << 32) + ntohl(x >> 32)) #define ntohll(x) ((((UInt64)ntohl((UInt32)x)) << 32) + ntohl(x >> 32))
@ -11,9 +11,9 @@
// Changes endianness // Changes endianness
inline UInt64 HostToNetwork8(const void * a_Value) inline UInt64 HostToNetwork8(const void * a_Value)
{ {
unsigned long long buf; UInt64 buf;
memcpy( &buf, a_Value, sizeof( buf)); memcpy( &buf, a_Value, sizeof( buf));
buf = (( ( (unsigned long long)htonl((u_long)buf)) << 32) + htonl(buf >> 32)); buf = (( ( (UInt64)htonl((UInt32)buf)) << 32) + htonl(buf >> 32));
return buf; return buf;
} }
@ -23,7 +23,7 @@ inline UInt64 HostToNetwork8(const void * a_Value)
inline UInt32 HostToNetwork4(const void* a_Value) inline UInt32 HostToNetwork4(const void* a_Value)
{ {
unsigned int buf; UInt32 buf;
memcpy( &buf, a_Value, sizeof( buf)); memcpy( &buf, a_Value, sizeof( buf));
buf = ntohl( buf); buf = ntohl( buf);
return buf; return buf;