=================================================================== RCS file: /home/cvs/OpenXM_contrib/pari-2.2/config/Attic/endian.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -p -r1.1 -r1.2 --- OpenXM_contrib/pari-2.2/config/Attic/endian.c 2001/10/02 11:16:55 1.1 +++ OpenXM_contrib/pari-2.2/config/Attic/endian.c 2002/09/11 07:26:39 1.2 @@ -1,19 +1,21 @@ +#include main() { - int i; - union + if (sizeof(long) == 4) { - unsigned long l; - char c[sizeof(long)]; - } u; - - if (sizeof(long) > 4) /* avoid "left shift count >= width of type" warning */ - u.l = (0x80706050UL << 28) | 0x04030201UL; + union {double d; unsigned long l[2];} x; + x.d = 2.; + if (x.l[0]==0 && x.l[1]==(1UL<<30)) printf("1\n"); + else if (x.l[1]==0 && x.l[0]==(1UL<<30)) printf("0\n"); + else + printf("NOT IEEE (32 bit)\n"); + } else - u.l = 0x04030201UL; - for (i = 0; i < sizeof(long); i++) - printf("%c", u.c[i]+'0'); - printf("\n"); - exit(0); + { + union {double d; unsigned long l;} x; + x.d = 2.; + if (x.l==(1UL<<62)) printf("-\n"); + else + printf("NOT IEEE (64 bit)\n"); + } } -