fetchoverlap.c

来自「Small Device C Compiler 面向Inter8051」· C语言 代码 · 共 34 行

C
34
字号
/* Test to reproduce a bug in the z80 compiler where A is used as the   left and right of an operand.*/#include <testfwk.h>#include <string.h>/* In the previous bug, both *p and val in the compare operation were   assigned into A due to *p being packed for ACC use into A.*/intverifyBlock(char *p, char val, int len){  while (len--) {    if (*p++ != val) {      return 0;    }  }  return 1;}voidtestOverlap(void){  char buf[20];  memset(buf, 12, sizeof(buf));  buf[12] = 13;  ASSERT(!verifyBlock(buf, 12, sizeof(buf)));  buf[12] = 12;  ASSERT(verifyBlock(buf, 12, sizeof(buf)));}

⌨️ 快捷键说明

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