Mercurial > hg > CbC > old > device
view test/inline.c @ 553:293f827ccfb2 linux-kernel-source
Linux kernel source compiled.
author | kono |
---|---|
date | Thu, 05 Jan 2006 21:29:55 +0900 |
parents | 74bbea56b8e5 |
children | ef225b589888 |
line wrap: on
line source
const int a = 5,b = -3; int kkkk = 333; static const int as = 5,bs = -3; const char hoo[] = "test"; char hoo0[] = "test"; static const char haa[] = "test"; static inline const int f(int k); volatile const int i = 3; extern int printf(char *,...); inline int main0() { volatile const int j = 3; switch(i) { case 1: printf("#0016:1\n"); break; case 2: printf("#0017:2\n"); break; case 3: printf("#0018:3\n"); break; case 4: printf("#0019:4\n"); break; } switch(j) { case 1: printf("#0022:1\n"); break; case 2: printf("#0023:2\n"); break; case 3: printf("#0024:3\n"); break; case 4: printf("#0025:4\n"); break; } return 0; } int main1() { volatile const int j = 3; switch(i) { case 1: printf("#0035:1\n"); break; case 2: printf("#0036:2\n"); break; case 3: printf("#0037:3\n"); break; case 4: printf("#0038:4\n"); break; } switch(j) { case 1: printf("#0041:1\n"); break; case 2: printf("#0042:2\n"); break; case 3: printf("#0043:3\n"); break; case 4: printf("#0044:4\n"); break; } return 0; } extern int printf(char *,...); static inline const int f(int k) { return k+1; } inline int in1(int i,int j) { if (i>j) return j; else return i; } static inline int ins(int i,int j) { printf("#0066:%d %d\n",i,j); if (f(i)>j) return j; else return i; } static inline int ins1(int i,int j, int k) { printf("#0074:%d %d %d\n",i,j,k); if (f(i)>j) return j; else return i; } inline __attribute__((always_inline)) int in2(int p,int i,int j) { int k = -20,m; int order=1; do { order <<= 4; order|=0; k += 3; order <<= 4; order|=7; } while ( k < j); printf("#0088: %d do %d %x\n",p,k,order); while (k > j) { order <<= 4; order|=0; k -= 3; order <<= 4; order|=7; } printf("#0095: %d while %d %x\n",p,k,order); m = 0; for(k=0;k<j;k++) { order <<= 4; order|=0; m += k; order <<= 4; order|=7; if (k&1) { order <<= 4; order|=0; m += k; order <<= 4; order|=7; } else { order <<= 4; order|=5; m += k; order <<= 4; order|=10; } printf("#0111: %x\n",order); } printf("#0113: %d for %d\n",p,m); switch(i) { case 1: k = 1; break; case 2: k = 2; break; case 3: k = 3; break; case 4: k = 4; break; default: k = 5; } printf("#0127: %d switch %d\n",p,k); for(k=0;k<j;k++) { i += k; if (k<3) continue; } printf("#0133: %d for %d\n",p,i); goto hoge; hage: goto hage; hoge: return 0; } int (*fnp)(int i,int j,int k); int (*fnp3)(int i,int j,int k); void a0(int k,int j) { int k1,j1; const int v=3,x=6; // a = 10; k1 = in1(a,b); printf("#0154:%d %d %d\n",a,b,k1); j1 = in1(k,j-6)+f(k1); printf("#0156:%d %d %s\n",k1,j1,hoo); k1 = &v-&x>0? &v-&x : &x-&v; printf("#0158:v-x: %d\n",k1); k1 = ins(a,b); j1 = ins(k,j-6)+f(k1); printf("#0162:%d %d %s\n",k1,j1,haa); k1 = ins(as,bs); j1 = ins(k,j-6)+f(k1); printf("#0166:%d %d %s\n",k1,j1,haa); k1 = ins(v,x); j1 = ins(k,j-6)+f(v); printf("#0170:%d %d %s\n",k1,j1,haa); k1 = fnp(v,x,5); j1 = ins1(k,j-6,6)+f(v); printf("#0174:%d %d %s\n",k1,j1,haa); } void a1(int k,int j) { in2(1,k,j); in2(2,3,10); in2(3,k,10); in2(4,2,j); in2(5,2,1); in2(6,0,2); in2(8,j*3,in2(7,k+3,10-j)); fnp3(9,0,2); } static inline int order(int a0,int a1,int a2, int a3, int a4) { printf("#0193:order %d %d %d %d %d\n",a0,a1,a2,a3,a4); } static inline int order1(int a0,int a1,int a2, int a3, int a4) { printf("#0199:orderp %d %d %d %d %d\n",a0,a1,a2,a3,a4); } int (*order1p)(int a0,int a1,int a2, int a3, int a4) = order1; static inline int inmain(int ac,char *av[]) { fnp = ins1; order(11,12,13,14,15); order1p(11,12,13,14,15); a0(15,16); a0(-19,16); fnp3 = in2; a1(19,110); main0(ac,av); return 0; } int main(int ac,char *av[]) { fnp = ins1; printf("#0222:%d\n",(1,2,3,4,5)); order(1,2,3,4,5); order1p(1,2,3,4,5); a0(5,6); a0(-9,6); fnp3 = in2; a1(9,10); main0(ac,av); main1(ac,av); inmain(ac,av); return 0; }