From 9fe21fcd8883b37bdc30224822e6e42afb35b8f0 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 7 Feb 2016 16:18:13 +0300 Subject: Replace most static_cast to shorter versions from defines. --- src/net/tmwa/messagein.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/net/tmwa/messagein.cpp') diff --git a/src/net/tmwa/messagein.cpp b/src/net/tmwa/messagein.cpp index 21e679b25..c8cf350e7 100644 --- a/src/net/tmwa/messagein.cpp +++ b/src/net/tmwa/messagein.cpp @@ -56,10 +56,10 @@ uint16_t MessageIn::readId() { #if SDL_BYTEORDER == SDL_BIG_ENDIAN int16_t swap; - memcpy(&swap, mData + static_cast(mPos), sizeof(int16_t)); + memcpy(&swap, mData + CAST_SIZE(mPos), sizeof(int16_t)); value = SDL_Swap16(swap); #else - memcpy(&value, mData + static_cast(mPos), sizeof(int16_t)); + memcpy(&value, mData + CAST_SIZE(mPos), sizeof(int16_t)); #endif } return value; @@ -72,14 +72,14 @@ int16_t MessageIn::readInt16(const char *const str) { #if SDL_BYTEORDER == SDL_BIG_ENDIAN int16_t swap; - memcpy(&swap, mData + static_cast(mPos), sizeof(int16_t)); + memcpy(&swap, mData + CAST_SIZE(mPos), sizeof(int16_t)); value = SDL_Swap16(swap); #else - memcpy(&value, mData + static_cast(mPos), sizeof(int16_t)); + memcpy(&value, mData + CAST_SIZE(mPos), sizeof(int16_t)); #endif } - DEBUGLOG2("readInt16: " + toStringPrint(static_cast( - static_cast(value))), + DEBUGLOG2("readInt16: " + toStringPrint(CAST_U32( + CAST_U16(value))), mPos, str); mPos += 2; PacketCounters::incInBytes(2); @@ -93,13 +93,13 @@ int32_t MessageIn::readInt32(const char *const str) { #if SDL_BYTEORDER == SDL_BIG_ENDIAN int32_t swap; - memcpy(&swap, mData + static_cast(mPos), sizeof(int32_t)); + memcpy(&swap, mData + CAST_SIZE(mPos), sizeof(int32_t)); value = SDL_Swap32(swap); #else - memcpy(&value, mData + static_cast(mPos), sizeof(int32_t)); + memcpy(&value, mData + CAST_SIZE(mPos), sizeof(int32_t)); #endif } - DEBUGLOG2("readInt32: " + toStringPrint(static_cast(value)), + DEBUGLOG2("readInt32: " + toStringPrint(CAST_U32(value)), mPos, str); mPos += 4; PacketCounters::incInBytes(4); @@ -118,13 +118,13 @@ int64_t MessageIn::readInt64(const char *const str) { #if SDL_BYTEORDER == SDL_BIG_ENDIAN int64_t swap; - memcpy(&swap, mData + static_cast(mPos), sizeof(int64_t)); + memcpy(&swap, mData + CAST_SIZE(mPos), sizeof(int64_t)); value = SDL_Swap64(swap); #else - memcpy(&value, mData + static_cast(mPos), sizeof(int64_t)); + memcpy(&value, mData + CAST_SIZE(mPos), sizeof(int64_t)); #endif } - DEBUGLOG2("readInt64: " + toStringPrint(static_cast(value)), + DEBUGLOG2("readInt64: " + toStringPrint(CAST_U32(value)), mPos, str); mPos += 8; PacketCounters::incInBytes(8); -- cgit v1.2.3-60-g2f50