annotate test/long.c @ 423:8b9136a06f56

bitfield continue...
author kono
date Fri, 29 Oct 2004 14:20:19 +0900
parents 3e8ba7024d25
children 0c256ea2a97e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
1
ce0c38b6c85e try long long
kono
parents:
diff changeset
2 long long gj;
ce0c38b6c85e try long long
kono
parents:
diff changeset
3 long long gi;
ce0c38b6c85e try long long
kono
parents:
diff changeset
4
ce0c38b6c85e try long long
kono
parents:
diff changeset
5 long long a[100];
ce0c38b6c85e try long long
kono
parents:
diff changeset
6 unsigned long long b[100];
ce0c38b6c85e try long long
kono
parents:
diff changeset
7 unsigned long long c[100];
ce0c38b6c85e try long long
kono
parents:
diff changeset
8
279
3e8ba7024d25 MIPS struct fix (all test except 2 passed.)
kono
parents: 244
diff changeset
9 long long data[] = {2342342342304234LL,2342342340234234LL,
3e8ba7024d25 MIPS struct fix (all test except 2 passed.)
kono
parents: 244
diff changeset
10 -234234342340234LL, -2342342342340234LL };
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
11 unsigned long long udata[] = {2342342334234LL,23423423434234LL,
279
3e8ba7024d25 MIPS struct fix (all test except 2 passed.)
kono
parents: 244
diff changeset
12 -23423423234234LL, -234234234234234LL};
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
13
ce0c38b6c85e try long long
kono
parents:
diff changeset
14 long long f(long long i,unsigned long long j,unsigned long long k,long long m,long long a);
ce0c38b6c85e try long long
kono
parents:
diff changeset
15 unsigned
ce0c38b6c85e try long long
kono
parents:
diff changeset
16 long long g(long long i,unsigned long long j,unsigned long long k,long long m,long long a);
ce0c38b6c85e try long long
kono
parents:
diff changeset
17
ce0c38b6c85e try long long
kono
parents:
diff changeset
18 void
ce0c38b6c85e try long long
kono
parents:
diff changeset
19 test3();
ce0c38b6c85e try long long
kono
parents:
diff changeset
20
ce0c38b6c85e try long long
kono
parents:
diff changeset
21 float f2ll(long long i) { float r;
ce0c38b6c85e try long long
kono
parents:
diff changeset
22 r = i ;
ce0c38b6c85e try long long
kono
parents:
diff changeset
23 return r; }
ce0c38b6c85e try long long
kono
parents:
diff changeset
24 double d2ll(long long i) { double r;
ce0c38b6c85e try long long
kono
parents:
diff changeset
25 r = i ;
ce0c38b6c85e try long long
kono
parents:
diff changeset
26 return r; }
ce0c38b6c85e try long long
kono
parents:
diff changeset
27 float f2ull(unsigned long long i) { float r;
ce0c38b6c85e try long long
kono
parents:
diff changeset
28 r = i ;
ce0c38b6c85e try long long
kono
parents:
diff changeset
29 return r; }
ce0c38b6c85e try long long
kono
parents:
diff changeset
30 double d2ull(unsigned long long i) { double r;
ce0c38b6c85e try long long
kono
parents:
diff changeset
31 r = i ;
ce0c38b6c85e try long long
kono
parents:
diff changeset
32 return r; }
ce0c38b6c85e try long long
kono
parents:
diff changeset
33 long long ll2f(float f) { long long r;
ce0c38b6c85e try long long
kono
parents:
diff changeset
34 r = f ;
ce0c38b6c85e try long long
kono
parents:
diff changeset
35 return r; }
ce0c38b6c85e try long long
kono
parents:
diff changeset
36 long long ll2d(double d) { long long r;
ce0c38b6c85e try long long
kono
parents:
diff changeset
37 r = d ;
ce0c38b6c85e try long long
kono
parents:
diff changeset
38 return r; }
ce0c38b6c85e try long long
kono
parents:
diff changeset
39 unsigned long long ull2f(float f) { unsigned long long r;
ce0c38b6c85e try long long
kono
parents:
diff changeset
40 r = f ;
ce0c38b6c85e try long long
kono
parents:
diff changeset
41 return r; }
ce0c38b6c85e try long long
kono
parents:
diff changeset
42 unsigned long long ull2d(double d) { unsigned long long r;
ce0c38b6c85e try long long
kono
parents:
diff changeset
43 r = d ;
ce0c38b6c85e try long long
kono
parents:
diff changeset
44 return r; }
ce0c38b6c85e try long long
kono
parents:
diff changeset
45
ce0c38b6c85e try long long
kono
parents:
diff changeset
46 main()
ce0c38b6c85e try long long
kono
parents:
diff changeset
47 {
233
2208a18f3799 *** empty log message ***
kono
parents: 232
diff changeset
48 long long int ii;
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
49 long long i,k,*p;
ce0c38b6c85e try long long
kono
parents:
diff changeset
50 unsigned long long j,m,*up;
ce0c38b6c85e try long long
kono
parents:
diff changeset
51 unsigned long long g0,h0;
ce0c38b6c85e try long long
kono
parents:
diff changeset
52 long long g1,h1;
ce0c38b6c85e try long long
kono
parents:
diff changeset
53 unsigned long long sg0,sh0;
ce0c38b6c85e try long long
kono
parents:
diff changeset
54 long long sg1,sh1;
ce0c38b6c85e try long long
kono
parents:
diff changeset
55 unsigned long long *pg0,*ph0;
ce0c38b6c85e try long long
kono
parents:
diff changeset
56 long long *pg1,*ph1;
ce0c38b6c85e try long long
kono
parents:
diff changeset
57 unsigned long long *psg0,*psh0;
ce0c38b6c85e try long long
kono
parents:
diff changeset
58 long long *psg1,*psh1;
ce0c38b6c85e try long long
kono
parents:
diff changeset
59
ce0c38b6c85e try long long
kono
parents:
diff changeset
60
ce0c38b6c85e try long long
kono
parents:
diff changeset
61 i = -2343423423424234234LL;
ce0c38b6c85e try long long
kono
parents:
diff changeset
62 j = 3424223422342234224LL;
ce0c38b6c85e try long long
kono
parents:
diff changeset
63 k = 44;
ce0c38b6c85e try long long
kono
parents:
diff changeset
64 k = i*j+3+k;
ce0c38b6c85e try long long
kono
parents:
diff changeset
65 m = i*j-7+k;
ce0c38b6c85e try long long
kono
parents:
diff changeset
66 printf("%lld %lld %llu\n",i,k,m);
ce0c38b6c85e try long long
kono
parents:
diff changeset
67 printf("%lld %lld %llu\n",i,1231234234233LL,m);
222
3d214303bae9 *** empty log message ***
kono
parents: 193
diff changeset
68 printf("0x%llx 0x%llx 0x%llx\n",i,k,m);
3d214303bae9 *** empty log message ***
kono
parents: 193
diff changeset
69 printf("0x%llx 0x%llx 0x%llx\n",i,1231234234233LL,m);
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
70
ce0c38b6c85e try long long
kono
parents:
diff changeset
71 g0 = -2343423423424234234LL;
ce0c38b6c85e try long long
kono
parents:
diff changeset
72 g0++; --g0;
ce0c38b6c85e try long long
kono
parents:
diff changeset
73 ++g0; g0--;
ce0c38b6c85e try long long
kono
parents:
diff changeset
74 printf("g0=%lld\n",g0);
222
3d214303bae9 *** empty log message ***
kono
parents: 193
diff changeset
75 printf("g0=0x%llx\n",g0);
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
76 g1 = -2343423423424234234LL;
ce0c38b6c85e try long long
kono
parents:
diff changeset
77 g1++; --g1;
ce0c38b6c85e try long long
kono
parents:
diff changeset
78 ++g1; g1--;
ce0c38b6c85e try long long
kono
parents:
diff changeset
79 printf("g1=%lld\n",g1);
222
3d214303bae9 *** empty log message ***
kono
parents: 193
diff changeset
80 printf("g1=0x%llx\n",g1);
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
81
ce0c38b6c85e try long long
kono
parents:
diff changeset
82 sg0 = 2343423423424234234LL;
ce0c38b6c85e try long long
kono
parents:
diff changeset
83 sg0++; --sg0;
ce0c38b6c85e try long long
kono
parents:
diff changeset
84 ++sg0; sg0--;
ce0c38b6c85e try long long
kono
parents:
diff changeset
85 printf("sg0=%lld\n",sg0);
ce0c38b6c85e try long long
kono
parents:
diff changeset
86 sg1 = -2343423423424234234LL;
ce0c38b6c85e try long long
kono
parents:
diff changeset
87 sg1++; --sg1;
ce0c38b6c85e try long long
kono
parents:
diff changeset
88 ++sg1; sg1--;
ce0c38b6c85e try long long
kono
parents:
diff changeset
89 printf("sg1=%lld\n",sg1);
ce0c38b6c85e try long long
kono
parents:
diff changeset
90
ce0c38b6c85e try long long
kono
parents:
diff changeset
91 pg0 = &g0;
ce0c38b6c85e try long long
kono
parents:
diff changeset
92 ph0 = &h0;
ce0c38b6c85e try long long
kono
parents:
diff changeset
93 *pg0 = -2343423423424234234LL;
ce0c38b6c85e try long long
kono
parents:
diff changeset
94 //*pg0++; *--pg0;
ce0c38b6c85e try long long
kono
parents:
diff changeset
95 //*++pg0; *g0--;
ce0c38b6c85e try long long
kono
parents:
diff changeset
96 printf("g0=%lld\n",*pg0);
ce0c38b6c85e try long long
kono
parents:
diff changeset
97 pg1 = &g1;
ce0c38b6c85e try long long
kono
parents:
diff changeset
98 ph1 = &h1;
ce0c38b6c85e try long long
kono
parents:
diff changeset
99 *pg1 = -2343423423424234234LL;
ce0c38b6c85e try long long
kono
parents:
diff changeset
100 //*pg1++; --*pg1;
ce0c38b6c85e try long long
kono
parents:
diff changeset
101 //++*pg1; *pg1--;
ce0c38b6c85e try long long
kono
parents:
diff changeset
102 printf("g1=%lld\n",*pg1);
ce0c38b6c85e try long long
kono
parents:
diff changeset
103
ce0c38b6c85e try long long
kono
parents:
diff changeset
104 psg0 = &sg0;
ce0c38b6c85e try long long
kono
parents:
diff changeset
105 psh0 = &sh0;
ce0c38b6c85e try long long
kono
parents:
diff changeset
106 *psg0 = -2343423423424234234LL;
ce0c38b6c85e try long long
kono
parents:
diff changeset
107 //*sg0++; *--sg0;
ce0c38b6c85e try long long
kono
parents:
diff changeset
108 //*++sg0; *sg0--;
ce0c38b6c85e try long long
kono
parents:
diff changeset
109 printf("sg0=%lld\n",*psg0);
ce0c38b6c85e try long long
kono
parents:
diff changeset
110 psg1 = &sg1;
ce0c38b6c85e try long long
kono
parents:
diff changeset
111 psh1 = &sh1;
ce0c38b6c85e try long long
kono
parents:
diff changeset
112 *psg1 = -2343423423424234234LL;
ce0c38b6c85e try long long
kono
parents:
diff changeset
113 //*sg1++; *--sg1;
ce0c38b6c85e try long long
kono
parents:
diff changeset
114 //*++sg1; *sg1--;
ce0c38b6c85e try long long
kono
parents:
diff changeset
115 printf("sg1=%lld\n",*psg1);
ce0c38b6c85e try long long
kono
parents:
diff changeset
116
ce0c38b6c85e try long long
kono
parents:
diff changeset
117
ce0c38b6c85e try long long
kono
parents:
diff changeset
118 h0 = g0 - 20;
ce0c38b6c85e try long long
kono
parents:
diff changeset
119 c[33] = g0;
ce0c38b6c85e try long long
kono
parents:
diff changeset
120
ce0c38b6c85e try long long
kono
parents:
diff changeset
121 if (i==j) { printf("i==j\n"); } else { printf("i!=j\n"); }
ce0c38b6c85e try long long
kono
parents:
diff changeset
122
ce0c38b6c85e try long long
kono
parents:
diff changeset
123 a[33] = i;
ce0c38b6c85e try long long
kono
parents:
diff changeset
124 b[33] = 2342342342342342342LL;
ce0c38b6c85e try long long
kono
parents:
diff changeset
125 printf("i=%lld\n",i);
ce0c38b6c85e try long long
kono
parents:
diff changeset
126 printf("j=%lld\n",j);
ce0c38b6c85e try long long
kono
parents:
diff changeset
127 i++; --i;
ce0c38b6c85e try long long
kono
parents:
diff changeset
128 j++; --j;
ce0c38b6c85e try long long
kono
parents:
diff changeset
129 printf("i=%lld\n",i);
ce0c38b6c85e try long long
kono
parents:
diff changeset
130 printf("j=%lld\n",j);
ce0c38b6c85e try long long
kono
parents:
diff changeset
131 gi = 2342342342342342342LL;
ce0c38b6c85e try long long
kono
parents:
diff changeset
132 gj = 2342342342342342342LL;
ce0c38b6c85e try long long
kono
parents:
diff changeset
133 gi++; --gi;
ce0c38b6c85e try long long
kono
parents:
diff changeset
134 gj++; --gj;
ce0c38b6c85e try long long
kono
parents:
diff changeset
135 printf("gi=%lld\n",gi);
ce0c38b6c85e try long long
kono
parents:
diff changeset
136 printf("gj=%lld\n",gj);
ce0c38b6c85e try long long
kono
parents:
diff changeset
137
ce0c38b6c85e try long long
kono
parents:
diff changeset
138 printf("k=%lld\n",k);
ce0c38b6c85e try long long
kono
parents:
diff changeset
139 printf("m=%lld\n",m);
222
3d214303bae9 *** empty log message ***
kono
parents: 193
diff changeset
140 printf("k=0x%llx\n",k);
3d214303bae9 *** empty log message ***
kono
parents: 193
diff changeset
141 printf("m=0x%llx\n",m);
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
142 printf("a[33]=%lld\n",a[33]);
ce0c38b6c85e try long long
kono
parents:
diff changeset
143 printf("b[33]=%lld\n",b[33]);
ce0c38b6c85e try long long
kono
parents:
diff changeset
144 printf("a[33]=%lld\n",++a[33]);
ce0c38b6c85e try long long
kono
parents:
diff changeset
145 printf("b[33]=%lld\n",b[33]--);
ce0c38b6c85e try long long
kono
parents:
diff changeset
146
ce0c38b6c85e try long long
kono
parents:
diff changeset
147 printf("g0=%lld\n",g0);
ce0c38b6c85e try long long
kono
parents:
diff changeset
148 printf("h0=%lld\n",h0);
ce0c38b6c85e try long long
kono
parents:
diff changeset
149 printf("c[33]=%lld\n",c[33]);
ce0c38b6c85e try long long
kono
parents:
diff changeset
150
ce0c38b6c85e try long long
kono
parents:
diff changeset
151 p = data;
ce0c38b6c85e try long long
kono
parents:
diff changeset
152 printf("*p++ = %lld\n",*p++);
ce0c38b6c85e try long long
kono
parents:
diff changeset
153 printf("*++p = %lld\n",*++p);
ce0c38b6c85e try long long
kono
parents:
diff changeset
154 *p++ = -2342342342342342342LL;
ce0c38b6c85e try long long
kono
parents:
diff changeset
155 printf("*p-- = %lld\n",*p--);
ce0c38b6c85e try long long
kono
parents:
diff changeset
156 printf("*--p = %lld\n",*--p);
ce0c38b6c85e try long long
kono
parents:
diff changeset
157 up = udata;
ce0c38b6c85e try long long
kono
parents:
diff changeset
158 printf("*up-- = %lld\n",*up--);
ce0c38b6c85e try long long
kono
parents:
diff changeset
159 printf("*--up = %lld\n",*--up);
ce0c38b6c85e try long long
kono
parents:
diff changeset
160 *up++ = 65530;
ce0c38b6c85e try long long
kono
parents:
diff changeset
161 printf("*up-- = %lld\n",*up--);
ce0c38b6c85e try long long
kono
parents:
diff changeset
162 printf("*--up = %lld\n",*--up);
ce0c38b6c85e try long long
kono
parents:
diff changeset
163
232
8a23c20ac92d *** empty log message ***
kono
parents: 222
diff changeset
164 printf("f(%lld %llu %llu %lld %lld)\n",i,j,k,m,a[33]);
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
165
ce0c38b6c85e try long long
kono
parents:
diff changeset
166 ii = f(i,j,k,m,a[33]);
ce0c38b6c85e try long long
kono
parents:
diff changeset
167 printf("f()=%lld\n",ii);
222
3d214303bae9 *** empty log message ***
kono
parents: 193
diff changeset
168 printf("f()=0x%llx\n",ii);
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
169 ii = g(i,j,k,m,a[33]);
222
3d214303bae9 *** empty log message ***
kono
parents: 193
diff changeset
170 printf("g()=%lld\n",ii);
3d214303bae9 *** empty log message ***
kono
parents: 193
diff changeset
171 printf("g()=0x%llx\n",ii);
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
172 test3();
ce0c38b6c85e try long long
kono
parents:
diff changeset
173 return 0;
ce0c38b6c85e try long long
kono
parents:
diff changeset
174 }
ce0c38b6c85e try long long
kono
parents:
diff changeset
175
ce0c38b6c85e try long long
kono
parents:
diff changeset
176 long long f(long long i,unsigned long long j,unsigned long long k,long long m,long long a)
ce0c38b6c85e try long long
kono
parents:
diff changeset
177 {
232
8a23c20ac92d *** empty log message ***
kono
parents: 222
diff changeset
178 printf("f(%lld %llu %llu %lld %lld)\n",i,j,k,m,a);
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
179 return i+j*k-m/a;
ce0c38b6c85e try long long
kono
parents:
diff changeset
180 }
ce0c38b6c85e try long long
kono
parents:
diff changeset
181
ce0c38b6c85e try long long
kono
parents:
diff changeset
182 unsigned
ce0c38b6c85e try long long
kono
parents:
diff changeset
183 long long g(long long i,unsigned long long j,unsigned long long k,long long m,long long a)
ce0c38b6c85e try long long
kono
parents:
diff changeset
184 {
ce0c38b6c85e try long long
kono
parents:
diff changeset
185 return i+j*k-m/a;
ce0c38b6c85e try long long
kono
parents:
diff changeset
186 }
ce0c38b6c85e try long long
kono
parents:
diff changeset
187
ce0c38b6c85e try long long
kono
parents:
diff changeset
188 void
ce0c38b6c85e try long long
kono
parents:
diff changeset
189 test3()
ce0c38b6c85e try long long
kono
parents:
diff changeset
190 {
244
39e28d6cfa56 ia32 long long done
kono
parents: 233
diff changeset
191 printf("test3-1:%g\ntest3-2:%g\ntest3-3:%g\ntest3-4:%g\ntest3-5:%lld\ntest3-6:%lld\ntest3-7:%llu\ntest3-8:%llu\n",
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
192 f2ll((long long ) -3423423234234LL),
ce0c38b6c85e try long long
kono
parents:
diff changeset
193 d2ll((long long ) -3423423234234LL),
ce0c38b6c85e try long long
kono
parents:
diff changeset
194 f2ull((unsigned long long ) 34234234234234LL),
ce0c38b6c85e try long long
kono
parents:
diff changeset
195 d2ull((unsigned long long ) 34234234234234LL),
244
39e28d6cfa56 ia32 long long done
kono
parents: 233
diff changeset
196 ll2f((float ) 2342423423423424234LL),
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
197 ll2d((double ) 2344234234244234234LL),
ce0c38b6c85e try long long
kono
parents:
diff changeset
198 ull2f((float ) 2344234234244234234LL),
ce0c38b6c85e try long long
kono
parents:
diff changeset
199 ull2d((double )2332342343234234234LL)
ce0c38b6c85e try long long
kono
parents:
diff changeset
200 );
ce0c38b6c85e try long long
kono
parents:
diff changeset
201
ce0c38b6c85e try long long
kono
parents:
diff changeset
202 }