diff --git a/src/m_swap.h b/src/m_swap.h index f5606e59c3..ddcf8eaf90 100644 --- a/src/m_swap.h +++ b/src/m_swap.h @@ -46,6 +46,11 @@ inline short LittleShort(int x) return OSSwapLittleToHostInt16((uint16_t)x); } +inline unsigned short LittleShort(unsigned int x) +{ + return OSSwapLittleToHostInt16((uint16_t)x); +} + inline int LittleLong(int x) { return OSSwapLittleToHostInt32((uint32_t)x); @@ -56,6 +61,16 @@ inline unsigned int LittleLong(unsigned int x) return OSSwapLittleToHostInt32(x); } +inline int LittleLong(long x) +{ + return OSSwapLittleToHostInt32((uint32_t)x); +} + +inline unsigned int LittleLong(unsigned long x) +{ + return OSSwapLittleToHostInt32((uint32_t)x); +} + inline short BigShort(short x) { return (short)OSSwapBigToHostInt16((uint16_t)x); diff --git a/src/serializer.cpp b/src/serializer.cpp index a23459ced0..445a3b22b0 100644 --- a/src/serializer.cpp +++ b/src/serializer.cpp @@ -1294,7 +1294,7 @@ FSerializer &SerializePointer(FSerializer &arc, const char *key, T *&value, T ** assert(base != nullptr); if (arc.isReading() || !arc.w->inObject() || defval == nullptr || value != *defval) { - ptrdiff_t vv = value == nullptr ? -1 : value - base; + int64_t vv = value == nullptr ? -1 : value - base; Serialize(arc, key, vv, nullptr); value = vv < 0 ? nullptr : base + vv; }