Big-endian/little-endian (WAS: Re: can I burn the output of mpg123 -s?)
Some of my programs have to work on big-endian and little-endian systems,
knowing what kind of system they are runing on (they are exchanging data
in binary format). To recognize the kind of the system I use the following
unsigned char c;
unsigned short int u;
if ((tst.c==1) && (tst.c==2)) return 1; /* big-endian */
if ((tst.c==2) && (tst.c==1)) return 0; /* little-endian */
return -1; /* This should not happen! Unknown integer representation */
On Tue, 18 Aug 1998, Stephen J. Carpenter wrote:
> On Tue, Aug 18, 1998 at 02:46:11AM +0100, email@example.com wrote:
> > On Mon, Aug 17, 1998 at 12:10:15PM -0500, the lone gunman wrote:
> > > On Mon, Aug 17, 1998 at 05:32:06PM +0100, firstname.lastname@example.org wrote:
> > >
> > > Does that mean that "intel byte order" is the same as "host byte
> > > order"?
> > Yes.
> well its not on my Sun IPC :)
> > > The man page for mpg123 says its output with the -s switch is
> > > "host byte order," but the cdrecord manpage makes no mention of host
> > > byte order, only intel byte order, little endian and big endian, and I
> > > have no clue what else.
> > >
> > > Can anyone offer an equivalence table for these types?
> > ok
> > Little endian = intel byte order = host byte order (if its an intel)
> > big endian = network byte order = host byte order (on 64 bit boxes)?
> I dunno if ALL 64 bit boxen are big endian.
> I know SUN systems are big-endian...I don't know about PPCs, or ALphas tho
> /* -- Stephen Carpenter <email@example.com> --- <firstname.lastname@example.org>------------ */
> E-mail "Bumper Stickers":
> "A FREE America or a Drug-Free America: You can't have both!"
> "honk if you Love Linux"