有人知道有什么好的资源可以用来学习 RAM 上的 walkpat 内存测试吗?如果你能提供伪代码或 C 代码那就更好了。提前致谢!
最佳答案
volatile int *ptr; // volatile because the compiler would otherwise outsmart you and not actually read the memory
for(ptr=0; ptr<SIZE; ptr++) {
int test = 1;
do {
*ptr = test;
if( *ptr != test ) FAIL();
test <<= 1; // walk that 1 through the word, until it falls off the end.
} while(test);
}
关于c - Walkpat内存测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17339058/