samp2407.c

来自「本测试程序是针对TMS320LF2407 EVM的性能测试而设计开发的。程序运行」· C语言 代码 · 共 80 行

C
80
字号
struct xxx {
              int         a,b,c;
              int         f1 : 2;
              int         f2 : 4;
              struct xxx *f3;
              int         f4[4];
            } str;

struct zzz { int b1,b2,b3,b4,b5;
             struct xxx q1[2],q2;
             struct xxx *q3;
           } big1;

struct     { int x,y,z;
             int **ptr;
             float *fptr;
             char ra[5];
           } small;

struct     { int u,v,w,x,y,z; } tiny6;

enum   yyy { RED, GREEN, BLUE } genum;

int    i;
short  s;
float  f;
double d;
int    aai[10][5];

extern  call();
extern  meminit();    

           
void bad_trap(void);
void bad_trap(void)
{
  while(1);                     /* a place to hang if illegal trap */
}


main()
{
    register int i = 0;
    int j = 0, k = 0;

    meminit();
    for (i = 0; i < 0x50000; i++)
    {
         call(i);
         if (i & 1) j += i;
         aai[k][k]  = j;
         if (!(i & 0xFFFF)) k++;
    }
    for (;;);
}

call(newvalue)
int newvalue;
{
    static int value = 0;

    switch (newvalue & 3)
    {
        case  0 : str.a = newvalue;      break;
        case  1 : str.b = newvalue + 1;  return;
        case  2 : str.c = newvalue * 2;            /* FALL THROUGH! */
        case  3 : xcall(newvalue);       break;
    }

    value = newvalue;
}

xcall(value)
int value;
{
    str.f1 += str.f2 - value;
}

meminit() {/*do nothing for C5x*/}

⌨️ 快捷键说明

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