SUMMARY: sun byte order

From: Darryl Pace (dpace@tacticsus.com)
Date: Mon Apr 20 1998 - 09:45:48 CDT


Sun Managers,
   Apparently, I've committed a faux pas of the highest order, i.e., I
unknowingly
sent spurious information to the list in my summary. After receiving
several
excoriations via email, I felt it necessary to re-send the summary, this
time
with the correct information. Thanks go to the following folks for
correcting
me:
Arthur Darren Dunham,
Chris Pillips,
Dave Mitchell,
Ian TCollins, and
Jochen Bern

Some of the the replies follow.
----------------------------------------------------------------------

Sorry, but this is complete nonsense. Endian is a processor attribute,
not an operating system one. For example,

Solaris running on Sparc is big-endian,
Solaris running on Intel is little-endian.

Just my $0.02

--------------------
Untrue! Solaris on intel is little-endian, byte order is platform
specific,
not OS specific.

        Ian
---------------------------------------
Jochen Bern sent the following interesting reply, which I've not yet
tested:

I suppose the utmost Detail would be to point out how to determine
it yourself on the Fly ...

penthesilea:/home/TI/bern% uname -s -r ; ./TMP
SunOS 4.1.3_U1
Byte Order: 1 2 3 4
(a.k.a. bigendian)
penthesilea:/home/TI/bern% cat TMP.c
#include <stdio.h>

main()

{ char c[4];
   int *i;

   if (sizeof(int)!=4)
   { printf("Please rewrite me for %d Byte Integers
first.\n",sizeof(int));
      exit(1);
   }

    i = (int *) c ;
   *i = (( 1 *256+ 2 )*256+ 3 )*256+ 4 ;
   printf("Byte Order: %d %d %d %d\n",c[0],c[1],c[2],c[3]);
   if (c[0]==1 && c[1]==2 && c[2]==3 && c[3]==4)
      printf("(a.k.a. bigendian)\n");
   if (c[0]==4 && c[1]==3 && c[2]==2 && c[3]==1)
      printf("(a.k.a. little-endian)\n");
   exit(0);
}

Regards,



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:12:38 CDT