comparison test/offset.c @ 558:528fed826f17 partial-evaluation

const value switch statement prune.
author kono
date Sat, 07 Jan 2006 12:46:38 +0900
parents ef225b589888
children a4445cb1aa91
comparison
equal deleted inserted replaced
557:c3053086f790 558:528fed826f17
14 int *p; 14 int *p;
15 int local_midium[BIT12]; 15 int local_midium[BIT12];
16 int local_large[BIT16]; 16 int local_large[BIT16];
17 17
18 #if 0 18 #if 0
19 printf("#0017:int ac =\t%x\n",&ac); 19 printf("#0018:int ac =\t%x\n",&ac);
20 printf("#0018:int midium[0] =\t%x\n",&midium[0]); 20 printf("#0019:int midium[0] =\t%x\n",&midium[0]);
21 printf("#0019:int midium[BIT12] =\t%x\n",&midium[BIT12]); 21 printf("#0020:int midium[BIT12] =\t%x\n",&midium[BIT12]);
22 printf("#0020:int large[0] =\t%x\n",&large[0]); 22 printf("#0021:int large[0] =\t%x\n",&large[0]);
23 printf("#0021:int large[BIT16] =\t%x\n",&large[BIT16]); 23 printf("#0022:int large[BIT16] =\t%x\n",&large[BIT16]);
24 printf("#0022:int local_midium[0] =\t%x\n",&local_midium[0]); 24 printf("#0023:int local_midium[0] =\t%x\n",&local_midium[0]);
25 printf("#0023:int local_midium[BIT12] =\t%x\n",&local_midium[BIT12]); 25 printf("#0024:int local_midium[BIT12] =\t%x\n",&local_midium[BIT12]);
26 printf("#0024:int local_large[0] =\t%x\n",&local_large[0]); 26 printf("#0025:int local_large[0] =\t%x\n",&local_large[0]);
27 printf("#0025:int local_large[BIT16] =\t%x\n",&local_large[BIT16]); 27 printf("#0026:int local_large[BIT16] =\t%x\n",&local_large[BIT16]);
28 #endif 28 #endif
29 29
30 midium[0]=0x55; 30 midium[0]=0x55;
31 large[0]=0x55; 31 large[0]=0x55;
32 local_midium[0]=0x55; 32 local_midium[0]=0x55;
45 midium[BIT12-1]=0xaa; 45 midium[BIT12-1]=0xaa;
46 large[BIT16-1]=0xaa; 46 large[BIT16-1]=0xaa;
47 local_midium[BIT12-1]=0xaa; 47 local_midium[BIT12-1]=0xaa;
48 local_large[BIT16-1]=0xaa; 48 local_large[BIT16-1]=0xaa;
49 49
50 printf("#0048:%x\n", midium[0]); 50 printf("#0049:%x\n", midium[0]);
51 printf("#0049:%x\n", large[0]); 51 printf("#0050:%x\n", large[0]);
52 printf("#0050:%x\n", local_midium[0]); 52 printf("#0051:%x\n", local_midium[0]);
53 printf("#0051:%x\n", local_large[0]); 53 printf("#0052:%x\n", local_large[0]);
54 54
55 printf("#0053:%x\n", midium[BIT8]); 55 printf("#0054:%x\n", midium[BIT8]);
56 printf("#0054:%x\n", large[BIT8]); 56 printf("#0055:%x\n", large[BIT8]);
57 printf("#0055:%x\n", local_midium[BIT8]); 57 printf("#0056:%x\n", local_midium[BIT8]);
58 printf("#0056:%x\n", local_large[BIT8]); 58 printf("#0057:%x\n", local_large[BIT8]);
59 59
60 printf("#0058:%x\n", midium[BIT10]); 60 printf("#0059:%x\n", midium[BIT10]);
61 printf("#0059:%x\n", large[BIT10]); 61 printf("#0060:%x\n", large[BIT10]);
62 printf("#0060:%x\n", local_midium[BIT10]); 62 printf("#0061:%x\n", local_midium[BIT10]);
63 printf("#0061:%x\n", local_large[BIT10]); 63 printf("#0062:%x\n", local_large[BIT10]);
64 64
65 printf("#0063:%x\n", midium[BIT12-1]); 65 printf("#0064:%x\n", midium[BIT12-1]);
66 printf("#0064:%x\n", large[BIT16-1]); 66 printf("#0065:%x\n", large[BIT16-1]);
67 printf("#0065:%x\n", local_midium[BIT12-1]); 67 printf("#0066:%x\n", local_midium[BIT12-1]);
68 printf("#0066:%x\n", local_large[BIT16-1]); 68 printf("#0067:%x\n", local_large[BIT16-1]);
69 69
70 p = local_large+BIT16; 70 p = local_large+BIT16;
71 71
72 p[-1] = 0xaa; 72 p[-1] = 0xaa;
73 p[-BIT8] = 0xbb; 73 p[-BIT8] = 0xbb;
74 p[-BIT10] = 0xcc; 74 p[-BIT10] = 0xcc;
75 p[-(BIT12-1)] = 0xdd; 75 p[-(BIT12-1)] = 0xdd;
76 p[-(BIT16-1)] = 0xee; 76 p[-(BIT16-1)] = 0xee;
77 77
78 printf("#0076:%x\n", p[-1]); 78 printf("#0077:%x\n", p[-1]);
79 printf("#0077:%x\n", p[-BIT8]); 79 printf("#0078:%x\n", p[-BIT8]);
80 printf("#0078:%x\n", p[-BIT10]); 80 printf("#0079:%x\n", p[-BIT10]);
81 printf("#0079:%x\n", p[-(BIT12-1)]); 81 printf("#0080:%x\n", p[-(BIT12-1)]);
82 printf("#0080:%x\n", p[-(BIT16-1)]); 82 printf("#0081:%x\n", p[-(BIT16-1)]);
83 83
84 p = large+BIT16; 84 p = large+BIT16;
85 85
86 p[-1] = 0xaa; 86 p[-1] = 0xaa;
87 p[-BIT8] = 0xbb; 87 p[-BIT8] = 0xbb;
88 p[-BIT10] = 0xcc; 88 p[-BIT10] = 0xcc;
89 p[-(BIT12-1)] = 0xdd; 89 p[-(BIT12-1)] = 0xdd;
90 p[-(BIT16-1)] = 0xee; 90 p[-(BIT16-1)] = 0xee;
91 91
92 printf("#0090:%x\n", p[-1]); 92 printf("#0091:%x\n", p[-1]);
93 printf("#0091:%x\n", p[-BIT8]); 93 printf("#0092:%x\n", p[-BIT8]);
94 printf("#0092:%x\n", p[-BIT10]); 94 printf("#0093:%x\n", p[-BIT10]);
95 printf("#0093:%x\n", p[-(BIT12-1)]); 95 printf("#0094:%x\n", p[-(BIT12-1)]);
96 printf("#0094:%x\n", p[-(BIT16-1)]); 96 printf("#0095:%x\n", p[-(BIT16-1)]);
97 97
98 98
99 for(p=local_midium;p<&local_midium[BIT12];p++) *p = p-local_midium; 99 for(p=local_midium;p<&local_midium[BIT12];p++) *p = p-local_midium;
100 for(p=local_large;p<&local_large[BIT16];p++) *p = p-local_large; 100 for(p=local_large;p<&local_large[BIT16];p++) *p = p-local_large;
101 101
109 { 109 {
110 int i=-1,j=-2,k=-3; 110 int i=-1,j=-2,k=-3;
111 111
112 main0(ac,av); 112 main0(ac,av);
113 113
114 printf("#0111:%d %d %d %d\n",ac,i,j,k); 114 printf("#0113:%d %d %d %d\n",ac,i,j,k);
115 return 0; 115 return 0;
116 } 116 }
117 117