示例#1
0
TerrainGrid::TerrainGrid(int maxGridSize, float gridDim){
	minGridSize =1;
	numVertices = 0;
	vertices = NULL;
	numQuads = 0;
	quads = NULL;
	numFacesDrawn = 0;
	
	this->maxGridSize = maxGridSize < minGridSize ? minGridSize : maxGridSize;
	this->gridDim = gridDim;
	CreateMemory();

	// Setup the material and lights used for the grid
	mat_ambient[0] = 0.0;
	mat_ambient[1] = 0.0;
	mat_ambient[2] = 0.0;
	mat_ambient[3] = 1.0;
	mat_specular[0] = 0.0;
	mat_specular[1] = 0.0;
	mat_specular[2] = 0.0;
	mat_specular[3] = 1.0;
	mat_diffuse[0] = 0.9;
	mat_diffuse[1] = 0.5;
	mat_diffuse[2] = 0.0;
	mat_diffuse[3] = 1.0;
	mat_shininess[0] = 0.0;
}
示例#2
0
	/* Should really be dependant on nM3 */
	psSub = CreateBinary (OPBINARY_ADD, CreateVariable ("sent"), COPY (psM2));
	apsOp[nPC] = SubstituteOperation (COPY (apsOp[nPC + 1]), psFind, psSub);

	FreeRecursive (psFind);
	psFind = NULL;
	FreeRecursive (psSub);
	psSub = NULL;
}

/*/
 =======================================================================================================================
 *  Apply the mid condition for LIB ReceiveInteger
 =======================================================================================================================
 */
void ApplyMidCondition_LibReceiveInteger_id3 (Operation **	apsOp, int nPC, Operation*	psM1, Operation*  psM2,
											  Operation*  psM3, Operation*	psMem, Operation*  psM1set,
											  Operation*  psM2set) {
	Operation*	psMemSub;
	Operation*	psSub;
	char szTemp[1024];

	psMemSub = NULL;
	psSub = NULL;

	/*
	 * channel = sc[nM3] ;
	 * receive = nM2 ;
	 * Establish a variable for the received data
	 */
	sprintf (szTemp, "r[%d]", gnCountReceived);
	gnCountReceived++;

	/* MOV *nM2 gnCountReceived */
	psSub = CreateVariable (szTemp);
	psMemSub = CreateTernary (OPTERNARY_SET, CreateMemory (), COPY (psM2set), CreateVariable (szTemp));
	apsOp[nPC] = SubstituteOperationPair (COPY (apsOp[nPC + 1]), psM2, psSub, psMem, psMemSub);
	FreeRecursive (psSub);
	psSub = NULL;
	FreeRecursive (psMemSub);
	psMemSub = NULL;
}
示例#3
0
/*			
어차피 m_bufferSize 변수가 현재 실제로 할당받을 수 있는 메모리의 총량을 뜻하므로.. 
m_allocatedMemoryBytes <= m_bufferSize 이다.
오버플로우가 걸린다면 m_bufferSize를 늘릴 때 걸릴 것이므로
if (m_pFree != nullptr) 안에서 메모리 오버플로우 검사를 할 필요는 없을 것이다.

실제로 큰 메모리를 할당 받으면 그걸 다 써야 다시 메모리 할당을 더 한다.
그렇기 때문에 부하가 걸리는 일은 없을 것이다.
*/
	void* CSlab::GetMemory()
	{
		if (m_pFree != nullptr)
		{
			// pop the element in 'memory block'
			char* pMemory = m_pFree;
			m_pFree = (char*)(*(PINT_PTR)m_pFree);
			
			m_allocatedMemoryBytes += m_classSize;
			return static_cast<void*>(pMemory);
		}
		else
		{
			if (OVERFLOWCHECK_ADD(m_bufferSize, m_bufferSize))
			{
				return nullptr;
			}

			m_pFree = CreateMemory();
			m_bufferSize += m_bufferSize;

			return GetMemory();
		}
	}
int main( int argc, char *argv[] ){
	struct Memory *  MemoryBank = CreateMemory();
	return EXIT_SUCCESS;
}
		VideoTransportClient() : VideoTransportBase(),
			haveframe( false ) {
				CreateMemory();
		}