Re: Help: How to determine big/little endian?

mab@wdl.loral.com (Mark A Biggar)
Fri, 1 Sep 1995 23:29:16 GMT

          From comp.compilers

Related articles
[7 earlier articles]
Re: Help: How to determine big/little endian? tim@franck.Princeton.EDU (1995-08-25)
Re: Help: How to determine big/little endian? meissner@cygnus.com (Michael Meissner) (1995-08-25)
Re: Help: How to determine big/little endian? cwf@research.att.com (Chris Fraser) (1995-08-25)
Re: Help: How to determine big/little endian? nr@cs.purdue.edu (1995-08-25)
Re: Help: How to determine big/little endian? doug@netcom.com (1995-08-26)
Re: Help: How to determine big/little endian? meissner@cygnus.com (Michael Meissner) (1995-09-01)
Re: Help: How to determine big/little endian? mab@wdl.loral.com (1995-09-01)
Re: Help: How to determine big/little endian? erik@kroete2.freinet.de (1995-09-03)
Re: Help: How to determine big/little endian? daniels@cse.ogi.edu (1995-09-13)
Re: Help: How to determine big/little endian? wdavis@dw3f.ess.harris.com (1995-09-26)
| List of all articles for this month |

Newsgroups: comp.arch,comp.compilers
From: mab@wdl.loral.com (Mark A Biggar)
Keywords: C, architecture
Organization: Loral Western Development Labs
References: <4074ig$nh7@masala.cc.uh.edu> 95-08-182 95-09-012
Date: Fri, 1 Sep 1995 23:29:16 GMT

>[Variable length integers seems to me a classic place for byte
>shifting and masking in an endian-independent way. Try it, you'll
>like it. I used to read network data structures with a big fread()
>followed by trying to byte-swap the parts that needed it. Then I
>wised up and read such stuff a value at a time with little routines
>that, e.g. read a two-byte bigendian integer. It's a lot easier to
>debug, and unless you're writing router code, the slowdown is
>insignificant. -John]


I have even gone so far as to advocate (in cases where time is not important)
not even borthering to store the data in binary. Storing data as human
readable text is almost always a win. It makes debugging output and creating
test data sets trivial and completely avoids endian and other binary format
issues. And in a lot of cases (especially when store lots of small numbers)
the data size difference is insigfinicant.


--
Mark Biggar
mab@wdl.loral.com


--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.