diff options
Diffstat (limited to 'src/serialize.h')
-rw-r--r-- | src/serialize.h | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/serialize.h b/src/serialize.h index d3f6b7d703..98b69aa228 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -19,16 +19,8 @@ #include <boost/tuple/tuple_comparison.hpp> #include <boost/tuple/tuple_io.hpp> -#if defined(_MSC_VER) || defined(__BORLANDC__) -typedef __int64 int64; -typedef unsigned __int64 uint64; -#else typedef long long int64; typedef unsigned long long uint64; -#endif -#if defined(_MSC_VER) && _MSC_VER < 1300 -#define for if (false) ; else for -#endif #ifdef WIN32 #include <windows.h> @@ -197,8 +189,8 @@ template<typename Stream> inline void Unserialize(Stream& s, bool& a, int, int=0 inline unsigned int GetSizeOfCompactSize(uint64 nSize) { if (nSize < 253) return sizeof(unsigned char); - else if (nSize <= USHRT_MAX) return sizeof(unsigned char) + sizeof(unsigned short); - else if (nSize <= UINT_MAX) return sizeof(unsigned char) + sizeof(unsigned int); + else if (nSize <= std::numeric_limits<unsigned short>::max()) return sizeof(unsigned char) + sizeof(unsigned short); + else if (nSize <= std::numeric_limits<unsigned int>::max()) return sizeof(unsigned char) + sizeof(unsigned int); else return sizeof(unsigned char) + sizeof(uint64); } @@ -210,14 +202,14 @@ void WriteCompactSize(Stream& os, uint64 nSize) unsigned char chSize = nSize; WRITEDATA(os, chSize); } - else if (nSize <= USHRT_MAX) + else if (nSize <= std::numeric_limits<unsigned short>::max()) { unsigned char chSize = 253; unsigned short xSize = nSize; WRITEDATA(os, chSize); WRITEDATA(os, xSize); } - else if (nSize <= UINT_MAX) + else if (nSize <= std::numeric_limits<unsigned int>::max()) { unsigned char chSize = 254; unsigned int xSize = nSize; |