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

📄 memstore.direct.c

📁 代码优化,有效使用内存,透视优化技术,对比优化方法,如果你在追求代码效率的最大化,该资源你不能不读.
💻 C
字号:
/* ---------------------------------------------------------------------------
 *
 *			MEASUREMENT OF THE MEMORY INITIALIZATION SPEED IN BOTH DIRECTIONS
 *			===========================================================
 *
 * Build 0x001 26.08.2002
--------------------------------------------------------------------------- */

#include <DoCPU.h>

#define _PAGE_SIZE (4*K)				// size of one memory page
#define BLOCK_SIZE (4*M)				// processed block size


/* ---------------------------------------------------------------------------

								INITIALIZATION /---->

--------------------------------------------------------------------------- */
l_to_r(char *p)
{
			memset(p,0x66,BLOCK_SIZE);			// initializing memory
			A_READ(p,BLOCK_SIZE);				// imitating block processing
}


/* ---------------------------------------------------------------------------

							INITIALIZATION <-------/

--------------------------------------------------------------------------- */
r_to_l(char *p)
{
	char *p2;
	p2 = p;
	__asm{								// implement reverse copying in assembler
			STD							// setting the flag of reverse direction
			MOV	EDI,[p2]				// load the pointer to the block to be initialized into EDI
			MOV	ECX,BLOCK_SIZE/4		// load the number of double words to be written into ECX
			REP	STOSD					// initialize the memory by arbitrary value that happens to be contained in EAX
			MOV	[p2],EDI				// 钺眍怆

⌨️ 快捷键说明

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