示例#1
0
文件: Base.cpp 项目: h16o2u9u/rtoss
void	operator delete( void* iPtr ) {
	if ( iPtr == NULL )
		return;

	// 引数のメモリがテーブル内に存在するか?
	int	i = TableSearch( PointerHash(iPtr), iPtr );
	if ( i == -1 )
		throw Exception("確保された記録のないメモリを解放しようとしました。");
	// 解放処理
	free( gTable[i] );
	gTable[i] = NULL;
	gBlockSize[i] = 0;
}
示例#2
0
文件: Base.cpp 项目: h16o2u9u/rtoss
void*	operator new( size_t iSize ) {
	static	int	theAllocCount=0;

	void*	thePtr = malloc( iSize );
	memset( thePtr, 0xac, iSize );	// 確保したメモリを埋めておく
	if ( thePtr == NULL )
		throw Exception("メモリが足りません。");

	// 格納位置を得る
	int	i = TableSearch( PointerHash(thePtr), NULL );
	if ( i == -1 )
		throw Exception("メモリブロック格納テーブルが一杯です。");
	// 確保したメモリのアドレスを保持しておく
	gTable[i] = thePtr;
	gBlockSize[i] = iSize;
	gAllocCount[i] = theAllocCount++;
	return	thePtr;
}
示例#3
0
/**
 * Type hash implementation. 
 *
 * @param	Ref		Reference to hash
 * @return	hash value
 */
uint32 GetTypeHash( const FDependencyRef& Ref  )
{
	return PointerHash(Ref.Linker) ^ Ref.ExportIndex;
}
示例#4
0
/** Hash function required for TMap support */
uint32 GetTypeHash( const FUntypedBulkData* BulkData )
{
	return PointerHash(BulkData);
}