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

baynes@ukpsshp1.serigate.philips.nl
Mon, 21 Aug 1995 08:35:08 GMT

          From comp.compilers

Related articles
Re: Help: How to determine big/little endian? doconnor@sedona.intel.com (1995-08-17)
Re: Help: How to determine big/little endian? ECE@dwaf-hri.pwv.gov.za (John Carter) (1995-08-21)
Re: Help: How to determine big/little endian? baynes@ukpsshp1.serigate.philips.nl (1995-08-21)
Re: Help: How to determine big/little endian? pardo@cs.washington.edu (1995-08-21)
Re: Help: How to determine big/little endian? mw@ipx2.rz.uni-mannheim.de (1995-08-22)
Re: Help: How to determine big/little endian? tonyk@cybercom.net (1995-08-22)
Re: Help: How to determine big/little endian? paysan@informatik.tu-muenchen.de (1995-08-21)
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)
[8 later articles]
| List of all articles for this month |

Newsgroups: comp.arch,comp.compilers
From: baynes@ukpsshp1.serigate.philips.nl
Keywords: architecture, C
Organization: Compilers Central
References: <4074ig$nh7@masala.cc.uh.edu> 95-08-120
Date: Mon, 21 Aug 1995 08:35:08 GMT

Dennis O'Connor -FT-~ (doconnor@sedona.intel.com) wrote:
: So, how about it, GNU and ANSI ? Let's see __BIGEND__
: and __LITTLEEND__ incorporated into the standards.


: [How often in otherwise platform independent code do you really need to know
: the byte order? I've almost always been able to program around it without
: much trouble. -John]


I would agree with John that you don't realy need to know. What is more there
are many cases where just big and little endian is not enough information
about the processor to use it anyway. You are much better to use explicit
shifts and masks.


For example some machines can have different word endian from byte endian
Ex 4 byte integer 0x12345678 can be stored as:
                12 34 56 78
                34 12 78 56
                56 78 12 34
                78 56 34 12


Then there are machines with holes in their integers - eg only using
3 bytes out of 4. Some one even told me of a machine that stored integers as
denormalized floating point numbers. So what order the bits are in compared
to a char is a good question on such a machine.


Normally the endianness is normally of interest for binary data from an
external source. Then one is worried about other things too such as number of
bits per char and how negative numbers are stored.


--
Stephen Baynes baynes@mulsoc2.serigate.philips.nl
Philips Semiconductors Ltd
Southampton
United Kingdom
--


Post a followup to this message

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