aboutsummaryrefslogtreecommitdiff
path: root/src/serialize.h
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2011-12-20 08:52:22 -0800
committerGavin Andresen <gavinandresen@gmail.com>2011-12-20 08:52:22 -0800
commit74f5435e104be76cd342a9a196ed4a10b8a7e248 (patch)
tree254f76dfa15c36a359e661caa1b4cfd158e204f4 /src/serialize.h
parent3528650560a2c417da2303869c743da019defc6d (diff)
parent9ef7fa344741cb34ba4e15cff06d61d1c7a74e24 (diff)
Merge pull request #716 from gavinandresen/cleanup
Cleanups suggested by genjix
Diffstat (limited to 'src/serialize.h')
-rw-r--r--src/serialize.h16
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;