Mercurial > hg > CbC > old > device
view test/long.c @ 867:33d00c6b2a7e
In ARG_ORDER==NORMAL, max_freg computation is wrong in i64
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 01 Apr 2014 01:57:36 +0900 |
parents | ba7110017db5 |
children | 5313ed059cee |
line wrap: on
line source
int printf(const char *format, ...); long long gj; long long gi; long long a[100]; unsigned long long b[100]; unsigned long long c[100]; long long data[] = {2342342342304234LL,2342342340234234LL, -234234342340234LL, -2342342342340234LL }; unsigned long long udata[] = {2342342334234LL,23423423434234LL, -23423423234234LL, -234234234234234LL}; long long f(long long i,unsigned long long j,unsigned long long k,long long m,long long a); unsigned long long g(long long i,unsigned long long j,unsigned long long k,long long m,long long a); void test3(); float f2ll(long long i) { float r; r = i ; return r; } double d2ll(long long i) { double r; r = i ; return r; } float f2ull(unsigned long long i) { float r; r = i ; return r; } double d2ull(unsigned long long i) { double r; r = i ; return r; } long long ll2f(float f) { long long r; r = f ; return r; } long long ll2d(double d) { long long r; r = d ; return r; } unsigned long long ull2f(float f) { unsigned long long r; r = f ; return r; } unsigned long long ull2d(double d) { unsigned long long r; r = d ; return r; } main() { long long int ii; long long i,k,*p; unsigned long long j,m,*up; unsigned long long g0,h0; long long g1,h1; unsigned long long sg0,sh0; long long sg1,sh1; unsigned long long *pg0,*ph0; long long *pg1,*ph1; unsigned long long *psg0,*psh0; long long *psg1,*psh1; i = -2343423423424234234LL; j = 3424223422342234224LL; k = 44; k = i*j+3+k; m = i*j-7+k; printf("#0067:%lld %lld %llu\n",i,k,m); printf("#0068:%lld %lld %llu\n",i,1231234234233LL,m); printf("#0069:0x%llx 0x%llx 0x%llx\n",i,k,m); printf("#0070:0x%llx 0x%llx 0x%llx\n",i,1231234234233LL,m); g0 = -2343423423424234234LL; g0++; --g0; ++g0; g0--; printf("#0075:g0=%lld\n",g0); printf("#0076:g0=0x%llx\n",g0); g1 = -2343423423424234234LL; g1++; --g1; ++g1; g1--; printf("#0080:g1=%lld\n",g1); printf("#0081:g1=0x%llx\n",g1); sg0 = 2343423423424234234LL; sg0++; --sg0; ++sg0; sg0--; printf("#0086:sg0=%lld\n",sg0); sg1 = -2343423423424234234LL; sg1++; --sg1; ++sg1; sg1--; printf("#0090:sg1=%lld\n",sg1); pg0 = &g0; ph0 = &h0; *pg0 = -2343423423424234234LL; //*pg0++; *--pg0; //*++pg0; *g0--; printf("#0097:g0=%lld\n",*pg0); pg1 = &g1; ph1 = &h1; *pg1 = -2343423423424234234LL; //*pg1++; --*pg1; //++*pg1; *pg1--; printf("#0103:g1=%lld\n",*pg1); psg0 = &sg0; psh0 = &sh0; *psg0 = -2343423423424234234LL; //*sg0++; *--sg0; //*++sg0; *sg0--; printf("#0110:sg0=%lld\n",*psg0); psg1 = &sg1; psh1 = &sh1; *psg1 = -2343423423424234234LL; //*sg1++; *--sg1; //*++sg1; *sg1--; printf("#0116:sg1=%lld\n",*psg1); h0 = g0 - 20; c[33] = g0; if (i==j) { printf("#0122:i==j\n"); } else { printf("#0122:i!=j\n"); } a[33] = i; b[33] = 2342342342342342342LL; printf("#0126:i=%lld\n",i); printf("#0127:j=%lld\n",j); i++; --i; j++; --j; printf("#0130:i=%lld\n",i); printf("#0131:j=%lld\n",j); gi = 2342342342342342342LL; gj = 2342342342342342342LL; gi++; --gi; gj++; --gj; printf("#0136:gi=%lld\n",gi); printf("#0137:gj=%lld\n",gj); printf("#0139:k=%lld\n",k); printf("#0140:m=%lld\n",m); printf("#0141:k=0x%llx\n",k); printf("#0142:m=0x%llx\n",m); printf("#0143:a[33]=%lld\n",a[33]); printf("#0144:b[33]=%lld\n",b[33]); printf("#0145:a[33]=%lld\n",++a[33]); printf("#0146:b[33]=%lld\n",b[33]--); printf("#0148:g0=%lld\n",g0); printf("#0149:h0=%lld\n",h0); printf("#0150:c[33]=%lld\n",c[33]); p = data; printf("#0153:*p++ = %lld\n",*p++); printf("#0154:*++p = %lld\n",*++p); *p++ = -2342342342342342342LL; printf("#0156:*p-- = %lld\n",*p--); printf("#0157:*--p = %lld\n",*--p); up = udata; printf("#0159:*up-- = %lld\n",*up--); printf("#0160:*--up = %lld\n",*--up); *up++ = 65530; printf("#0162:*up-- = %lld\n",*up--); printf("#0163:*--up = %lld\n",*--up); printf("#0165:f(%lld %llu %llu %lld %lld)\n",i,j,k,m,a[33]); ii = f(i,j,k,m,a[33]); printf("#0168:f()=%lld\n",ii); printf("#0169:f()=0x%llx\n",ii); ii = g(i,j,k,m,a[33]); printf("#0171:g()=%lld\n",ii); printf("#0172:g()=0x%llx\n",ii); test3(); return 0; } long long f(long long i,unsigned long long j,unsigned long long k,long long m,long long a) { printf("#0179:f(%lld %llu %llu %lld %lld)\n",i,j,k,m,a); return i+j*k-m/a; } unsigned long long g(long long i,unsigned long long j,unsigned long long k,long long m,long long a) { return i+j*k-m/a; } void test3() { printf("#0192: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", f2ll((long long ) -3423423234234LL), d2ll((long long ) -3423423234234LL), f2ull((unsigned long long ) 34234234234234LL), d2ull((unsigned long long ) 34234234234234LL), ll2f((float ) 2342423423423424234LL), ll2d((double ) 234423423424423423LL), ull2f((float ) 2344234234244234234LL), ull2d((double )233234234323423423LL) ); }