1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
/* run.config*
OPT: -val @VALUECONFIG@ -slevel 100 -cpp-extra-args="-DPTEST " -journal-disable -no-warn-signed-overflow
OPT: -val @VALUECONFIG@ -slevel 100 -cpp-extra-args="-DPTEST " -journal-disable -machdep ppc_32 -no-warn-signed-overflow
*/
#ifndef PTEST
#include <stdio.h>
#endif
#define S 100
char s[S];
int c=0;
int s_int;
int *p_int;
char ones[]="11111111";
char one23[]="1223";
int col_ones;
int col_123;
int main(void)
{
char *p = s;
col_ones = 1 + * (int*) ones;
col_123 = 1 + * (int*) one23;
while (p <= s+S-sizeof(int))
{
c = 7 * c + 97;
if (c % 3 == 0)
*p++ = c;
else if (c % 3 == 1)
{
*(short*)p = c;
p += sizeof(short);
}
else
{
*(int*)p = c;
p += sizeof(int);
}
}
for (p_int = (int*) s; p_int < (int*)(s+S); p_int++)
{
s_int = 11 * s_int + *p_int;
}
#ifndef PTEST
printf("s_int: %d col_ones: %d col_123:%d\n", s_int, col_ones, col_123);
#endif
/* rsultat attendu, avec int 32-bits :
little endian: s_int = -833811464
big_endian : s_int: -1480071902 col_ones: 825307442 col_123:825373236
*/
return 0;
}
|