コード例 #1
0
ファイル: data.cpp プロジェクト: Rimbok/warzone2100
// create the hash for that data block.
// Data should be converted to Network byte order
static void calcDataHash(uint8_t *pBuffer, uint32_t size, uint32_t index)
{
	const uint32_t oldHash = DataHash[index];

	if (!bMultiPlayer)
	{
		return;
	}

	DataHash[index] += hashBuffer(pBuffer, size);

	if (!DataHash[index] && oldHash)
	{
		debug(LOG_NET, "The new hash is 0, the old hash was %u. We added the negated value!", oldHash);
	}

	debug(LOG_NET, "DataHash[%2u] = %08x", index, DataHash[index]);

	return;
}
コード例 #2
0
ファイル: data.c プロジェクト: blezek/warzone2100
// create the hash for that data block.
// Data should be converted to Network byte order
static void calcDataHash(uint8_t *pBuffer, uint32_t size, uint32_t index)
{
	const uint32_t oldHash = DataHash[index];

	if (!bMultiPlayer)
	{
		return;
	}

	DataHash[index] ^= PHYSFS_swapUBE32(hashBuffer(pBuffer, size));

	if (!DataHash[index] && oldHash)
	{
		debug(LOG_NET, "The new hash is 0, the old hash was %u. We XOR'ed the same value!", oldHash);
	}

	debug(LOG_NET, "DataHash[%2u] = %08x", index, PHYSFS_swapUBE32(DataHash[index])); 

	return;
}
コード例 #3
0
ファイル: Hash.hpp プロジェクト: venceslas/ocull
template <> inline U32  hashArray<F64>  (const F64* ptr, int size)          { return hashBuffer(ptr, size * (int)sizeof(F64)); }
コード例 #4
0
ファイル: Hash.hpp プロジェクト: venceslas/ocull
template <> inline U32  hashArray<U16>  (const U16* ptr, int size)          { return hashBuffer(ptr, size * (int)sizeof(U16)); }
コード例 #5
0
ファイル: Hash.hpp プロジェクト: venceslas/ocull
template <> inline U32  hashArray<F32>  (const F32* ptr, int size)          { return hashBuffer(ptr, size * (int)sizeof(F32)); }
コード例 #6
0
ファイル: Hash.hpp プロジェクト: venceslas/ocull
template <> inline U32  hashArray<S8>   (const S8* ptr, int size)           { return hashBuffer(ptr, size * (int)sizeof(S8)); }
コード例 #7
0
ファイル: Hash.hpp プロジェクト: venceslas/ocull
template <class T>  inline U32  hash            (const T& value)                        { return hashBuffer(&value, sizeof(T)); }
コード例 #8
0
ファイル: Hash.hpp プロジェクト: venceslas/ocull
template <> inline U32  hash<std::string>    (const std::string& value)               { return hashBuffer(value.c_str(), value.length()); }
コード例 #9
0
template <> inline U32 hash<GenericHashKey>(const GenericHashKey& value) { return hashBuffer(value.ptr, value.size); }
コード例 #10
0
template <> inline U32  hash<String>    (const String& value)               { return hashBuffer(value.getPtr(), value.getLength()); }