Mercurial > hg > CbC > old > device
view test/short.c @ 391:a460a3f118d1
ARM continue...
author | kono |
---|---|
date | Wed, 08 Sep 2004 01:10:37 +0900 |
parents | 5b50813d0c45 |
children | 0c256ea2a97e |
line wrap: on
line source
short gj; short gi; short a[100]; unsigned short b[100]; unsigned char c[100]; short data[] = {10,20,-40,-50}; unsigned short udata[] = {10,20,-40,-50}; short f(short i,unsigned short j,unsigned short k,short m,short a); unsigned short g(short i,unsigned short j,unsigned short k,short m,short a); main() { int ii; short i,k,*p; unsigned short j,m,*up; unsigned char g0,h0; char g1,h1; unsigned short sg0,sh0; short sg1,sh1; unsigned char *pg0,*ph0; char *pg1,*ph1; unsigned short *psg0,*psh0; short *psg1,*psh1; i = -3; j = 3; k = 44; k = i*j+3+k; m = i*j-7+k; printf("%d %d %d\n",i,k,m); g0 = 123; g0++; --g0; ++g0; g0--; printf("g0=%d\n",g0); g1 = -123; g1++; --g1; ++g1; g1--; printf("g1=%d\n",g1); sg0 = 123; sg0++; --sg0; ++sg0; sg0--; printf("sg0=%d\n",sg0); sg1 = -123; sg1++; --sg1; ++sg1; sg1--; printf("sg1=%d\n",sg1); pg0 = &g0; ph0 = &h0; *pg0 = 123; //*pg0++; *--pg0; //*++pg0; *g0--; printf("g0=%d\n",*pg0); pg1 = &g1; ph1 = &h1; *pg1 = -123; //*pg1++; --*pg1; //++*pg1; *pg1--; printf("g1=%d\n",*pg1); psg0 = &sg0; psh0 = &sh0; *psg0 = 123; //*sg0++; *--sg0; //*++sg0; *sg0--; printf("sg0=%d\n",*psg0); psg1 = &sg1; psh1 = &sh1; *psg1 = -123; //*sg1++; *--sg1; //*++sg1; *sg1--; printf("sg1=%d\n",*psg1); h0 = g0 - 20; c[33] = g0; if (i==j) { printf("i==j\n"); } else { printf("i!=j\n"); } a[33] = i; b[33] = 105; printf("i=%d\n",i); printf("j=%d\n",j); i++; --i; j++; --j; printf("i=%d\n",i); printf("j=%d\n",j); gi = 3333; gj = 6666; gi++; --gi; gj++; --gj; printf("gi=%d\n",gi); printf("gj=%d\n",gj); printf("k=%d\n",k); printf("m=%d\n",m); printf("a[33]=%d\n",a[33]); printf("b[33]=%d\n",b[33]); printf("a[33]=%d\n",++a[33]); printf("b[33]=%d\n",b[33]--); printf("g0=%d\n",g0); printf("h0=%d\n",h0); printf("c[33]=%d\n",c[33]); p = data; printf("*p++ = %d\n",*p++); printf("*++p = %d\n",*++p); *p++ = -343; printf("*p-- = %d\n",*p--); printf("*--p = %d\n",*--p); up = udata; printf("*up-- = %d\n",*up--); printf("*--up = %d\n",*--up); *up++ = 65530; printf("*up-- = %d\n",*up--); printf("*--up = %d\n",*--up); ii = f(i,j,k,m,a[33]); printf("f()=%d\n",ii); ii = g(i,j,k,m,a[33]); printf("f()=%d\n",ii); return 0; } short f(short i,unsigned short j,unsigned short k,short m,short a) { return i+j*k-m/a; } unsigned short g(short i,unsigned short j,unsigned short k,short m,short a) { return i+j*k-m/a; }