⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cmm.h

📁 自己写的操作系统的实验:处理机调度模拟及内存分配模拟二合一小程序。
💻 H
字号:
#ifndef CMM_H
#define CMM_H

#define DEFAULT_SIZE 20
#define MM_TOTAL_SIZE 100
#define MM_MAX_SIZE 30
typedef unsigned int uint;
/*要使用Clist,需提供prep,nextp,和<(),>()*/
class Cmm
{
public:
	uint begin;
	uint size;
	Cmm* prep;
	Cmm* nextp;
public:
	Cmm():begin(0),size(0),prep(NULL),nextp(NULL){}
	/*p紧邻this,即p,this顺序*/
	bool extent_front(Cmm* p)
	{
		if( p && this->begin==p->begin+p->size )
		{
			this->begin=p->begin;
			this->size+=p->size;
			return true;
		}
		return false;
	}
	/*this紧邻p,即this,p顺序*/
	bool extent_back(Cmm* p)
	{
		if( p && p->begin==this->begin+this->size )
		{
			this->size+=p->size;
			return true;
		}
		return false;
	}
	bool div(uint needs)
	{
		if( size<needs )
			return false;
		size-=needs;
		begin+=needs;
		return true;
	}
};
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -