From 4843b55fd167c54d86eb9e1f19525ed363cfe72d Mon Sep 17 00:00:00 2001 From: "Ricardo M. Correia" Date: Sun, 13 May 2012 21:31:59 +0200 Subject: Make CNetAddr::GetHash() return an unsigned val. This prevents an undefined operation in main.cpp, when shifting the hash value left by 32 bits. Shifting a signed int left into the sign bit is undefined in C++11. --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 20bb56e964..f71702f0e5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2440,7 +2440,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) static uint256 hashSalt; if (hashSalt == 0) RAND_bytes((unsigned char*)&hashSalt, sizeof(hashSalt)); - int64 hashAddr = addr.GetHash(); + uint64 hashAddr = addr.GetHash(); uint256 hashRand = hashSalt ^ (hashAddr<<32) ^ ((GetTime()+hashAddr)/(24*60*60)); hashRand = Hash(BEGIN(hashRand), END(hashRand)); multimap mapMix; -- cgit v1.2.3