Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: fairfield@sldb6.slac.stanford.edu
Subject: Re: DEC Alpha- big endian or little endian?
Date: 1996/02/04	[thread overview]
Message-ID: <1996Feb3.215640.1@sldb6.slac.stanford.edu> (raw)
In-Reply-To: 4ejjs1$2pr@sun20.ccd.bnl.gov

In article <4ejjs1$2pr@sun20.ccd.bnl.gov>, 
    			olchansk@a0.phy.bnl.gov (Konstantin Olchanski) writes:
> 
> Folks- what is the endianess of the DEC Alpha machines?

        Little-endian...but you knew  that  or  you  wouldn't be asking,
    right?  :-)
 
[...]
> The problem is that all our data sets are written in the
> 	big-endian format and the little-endian version
> 	of our code cannot read them.
> 
> I understand that it is possible to write a
> 	"data converter" to covert our data between
> 	little-endian and big-endian representations.

        I'm more familiar with VMS than DEC  UNUIX, but I know that what
    follows  w.r.t. VMS has its analog in DEC UNIX.  Under VMS,  Digital
    Fortran   supports   a   command   line   qualifier,   or    switch,
    /CONVERT=BIG_ENDIAN,  that  allows  you  to  tell  the  compiler  to
    automatically  convert   external   big-endian   data   to  internal
    little-endian   format   on   READ,  and  to  WRITE   the   internal
    little-endian  data  to  external  files   as   big-endian   format.
    Additionally,  there  is  an  optional keyword to the OPEN statement
    that allows  you  to  do  the  same  thing  within  your  code  on a
    file-by-file  basis.   You'll need to check the fortran man page  to
    get the syntax for UNIX, but I'd wager it's something like -convert.

        This  applies  to  Fortran,  I  don't  think  the  I/O subsystem
    functionallity   exists  for  DEC  C.   Also,  there  may  be   some
    restrictions if the data in the external file are not all  the  same
    size  (i.e.,  mixed 4- and 8-byte items).  Someone from Digital will
    have to answer that (Steve Lionel?).

        Since IEEE is the  native  Alpha floating-point format on Alpha,
    you only need to byte swap, no other conversion is required.

[...]
> Is there some magic switch that we can flip to have the machine
> 	run in big-endian mode?

        No, but the Fortran language support does...

> Or maybe some hidden compiler switches to make it produce
> 	"big-endian" code?

        ...yes, as noted above for Fortran.

        Note also that even  if  you  must  use  C,  there  is a runtime
    library  conversion  routine  (CVT$CONVERT_FLOAT on  VMS,  something
    similarly named...but shorter and lowercase on UNIX :-) which, while
    doing  floating-point  conversion,  also  supports   big-endian   to
    little-endian  conversion.  Since it's in the rtl, it will have been
    optimized for speed on the  Alpha.   Whether it would be faster than
    your  own  byte-swapping code I can't say (haven't tested  it).   It
    will definitely be slower than using the Fortrna I/O subsystem since
    you need to call it for each data item, no arrays allowed.  :-(
 
> DEC must have provided some kind of solution to this problem,
> 	since it's hard to believe that they completely locked
> 	themselves out of the big-endian-workstation market!

        Nope. :-)

            -Ken
-- 
 Kenneth H. Fairfield       |  Internet: Fairfield@Slac.Stanford.Edu
 SLAC, P.O.Box 4349, MS 46  |  DECnet:   45537::FAIRFIELD (45537=SLACVX)
 Stanford, CA   94309       |  Voice:    415-926-2924    FAX: 415-926-3515
 -------------------------------------------------------------------------
 These opinions are mine, not SLAC's, Stanford's, nor the DOE's...



  parent reply	other threads:[~1996-02-04  5:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-01-29  5:00 DEC Alpha- big endian or little endian? Konstantin Olchanski
1996-02-03  5:00 ` John McNamara
1996-02-04  5:00   ` bruce
1996-02-09  5:00   ` Konstantin Olchanski
1996-02-16  5:00     ` bruce
1996-02-04  5:00 ` fairfield [this message]
1996-02-05  5:00 ` Steve Lionel
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox