[BACK]Return to endian.c CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / pari-2.2 / config

Diff for /OpenXM_contrib/pari-2.2/config/Attic/endian.c between version 1.1 and 1.2

version 1.1, 2001/10/02 11:16:55 version 1.2, 2002/09/11 07:26:39
Line 1 
Line 1 
   #include <stdio.h>
 main()  main()
 {  {
   int i;    if (sizeof(long) == 4)
   union  
   {    {
     unsigned long l;      union {double d; unsigned long l[2];} x;
     char c[sizeof(long)];      x.d = 2.;
   } u;      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");
   if (sizeof(long) > 4) /* avoid "left shift count >= width of type" warning */      else
     u.l = (0x80706050UL << 28) | 0x04030201UL;        printf("NOT IEEE (32 bit)\n");
     }
   else    else
     u.l = 0x04030201UL;    {
   for (i = 0; i < sizeof(long); i++)      union {double d; unsigned long l;} x;
     printf("%c", u.c[i]+'0');      x.d = 2.;
   printf("\n");      if (x.l==(1UL<<62)) printf("-\n");
   exit(0);      else
         printf("NOT IEEE (64 bit)\n");
     }
 }  }
   

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>