diff options
author | Alexander Harkness <me@bearbin.net> | 2024-11-02 22:27:47 +0100 |
---|---|---|
committer | Alexander Harkness <me@bearbin.net> | 2024-11-02 22:27:47 +0100 |
commit | cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a (patch) | |
tree | f647b20e1823f1846af88e832cf82a4a02e96e69 /src/Endianness.h | |
parent | Improve clang-format config file, remove automatically enforced code style from contrib guide. (diff) | |
download | cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.tar cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.tar.gz cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.tar.bz2 cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.tar.lz cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.tar.xz cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.tar.zst cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.zip |
Diffstat (limited to 'src/Endianness.h')
-rw-r--r-- | src/Endianness.h | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/Endianness.h b/src/Endianness.h index 0e8bc8e99..cfa859328 100644 --- a/src/Endianness.h +++ b/src/Endianness.h @@ -1,7 +1,7 @@ #pragma once -#undef ntohll +#undef ntohll #define ntohll(x) (((static_cast<UInt64>(ntohl(static_cast<UInt32>(x)))) << 32) + ntohl(x >> 32)) @@ -12,8 +12,8 @@ inline UInt64 HostToNetwork8(const void * a_Value) { UInt64 buf; - memcpy( &buf, a_Value, sizeof( buf)); - buf = (( ( static_cast<UInt64>(htonl(static_cast<UInt32>(buf)))) << 32) + htonl(buf >> 32)); + memcpy(&buf, a_Value, sizeof(buf)); + buf = (((static_cast<UInt64>(htonl(static_cast<UInt32>(buf)))) << 32) + htonl(buf >> 32)); return buf; } @@ -24,8 +24,8 @@ inline UInt64 HostToNetwork8(const void * a_Value) inline UInt32 HostToNetwork4(const void * a_Value) { UInt32 buf; - memcpy( &buf, a_Value, sizeof( buf)); - buf = ntohl( buf); + memcpy(&buf, a_Value, sizeof(buf)); + buf = ntohl(buf); return buf; } @@ -80,7 +80,3 @@ inline float NetworkToHostFloat4(const void * a_Value) memcpy(&x, &buf, sizeof(float)); return x; } - - - - |