Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
* big endian and little endian
@ 1994-12-06 19:17 Massimo Macucci
  1994-12-06 20:24 ` Steve Lionel
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Massimo Macucci @ 1994-12-06 19:17 UTC (permalink / raw)


This might be in the FAQ, but I have not been able to retrieve it.
A group here has developed applications on hp workstations, which are
"different" endian with respect to the Alphas. Now they would like 
to switch to the new Alphas, but they have the problem that binary
files cannot be exchanged between the hp's and the Alphas due to the 
different byte ordering.
Does anybody know a good solution for this problem, except for the 
obvious one of rewriting the application ?
                                         Massimo Macucci                      


-- 
--------------------------------------------------------------------------
|  macucci@pimic.iet.unipi.it                    |                       |
|  Dipartimento di Ingegneria dell'Informazione  |  Tel. +39 50 568537   |
|  Universita` di Pisa                           |                       |
|  Via Diotisalvi, 2                             |                       |
|  I-56126 PISA                                  |  FAX  +39 50 568522   |
|  Italy                                         |                       |
|                                                |                       |
--------------------------------------------------------------------------


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: big endian and little endian
  1994-12-06 19:17 big endian and little endian Massimo Macucci
@ 1994-12-06 20:24 ` Steve Lionel
  1994-12-06 23:18   ` Andrew Gallatin
  1994-12-06 21:26 ` Bruce Gordon
  1994-12-06 23:02 ` Stephen Hoffman
  2 siblings, 1 reply; 7+ messages in thread
From: Steve Lionel @ 1994-12-06 20:24 UTC (permalink / raw)



In article <3c2dc6$8po@serra.unipi.it>, ferrovia@pimac2.iet.unipi.it 
(Massimo Macucci) writes:
|>This might be in the FAQ, but I have not been able to retrieve it.
|>A group here has developed applications on hp workstations, which are
|>"different" endian with respect to the Alphas. Now they would like 
|>to switch to the new Alphas, but they have the problem that binary
|>files cannot be exchanged between the hp's and the Alphas due to the 
|>different byte ordering.
|>Does anybody know a good solution for this problem, except for the 
|>obvious one of rewriting the application ?

If the application is in Fortran, they can use the CONVERT='BIG_ENDIAN'
option in the OPEN statement which will cause DEC Fortran to automatically
do the byte-swap on input or output.  Otherwise it should be a straightforward
task to write a program to process the file and do the byte swap as
necessary.
-- 

Steve Lionel                      Mail: lionel@quark.enet.dec.com
DEC Fortran Development           WWW:  http://www.digital.com/info/slionel.html
Digital Equipment Corporation     CompuServe: 75263,3001
110 Spit Brook Road, ZKO2-3/N30
Nashua, NH 03062-2698             "Free advice is worth every cent"

For a summary of Digital's Internet services, send mail to info@digital.com


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: big endian and little endian
  1994-12-06 19:17 big endian and little endian Massimo Macucci
  1994-12-06 20:24 ` Steve Lionel
@ 1994-12-06 21:26 ` Bruce Gordon
  1994-12-06 23:02 ` Stephen Hoffman
  2 siblings, 0 replies; 7+ messages in thread
From: Bruce Gordon @ 1994-12-06 21:26 UTC (permalink / raw)


In article <3c2dc6$8po@serra.unipi.it>, ferrovia@pimac2.iet.unipi.it (Massimo Macucci) writes:
|> This might be in the FAQ, but I have not been able to retrieve it.
|> A group here has developed applications on hp workstations, which are
|> "different" endian with respect to the Alphas. Now they would like 
|> to switch to the new Alphas, but they have the problem that binary
|> files cannot be exchanged between the hp's and the Alphas due to the 
|> different byte ordering.
|> Does anybody know a good solution for this problem, except for the 
|> obvious one of rewriting the application ?
|>                                          Massimo Macucci                      
|> 
|> 
|> -- 
|> --------------------------------------------------------------------------
|> |  macucci@pimic.iet.unipi.it                    |                       |
|> |  Dipartimento di Ingegneria dell'Informazione  |  Tel. +39 50 568537   |
|> |  Universita` di Pisa                           |                       |
|> |  Via Diotisalvi, 2                             |                       |
|> |  I-56126 PISA                                  |  FAX  +39 50 568522   |
|> |  Italy                                         |                       |
|> |                                                |                       |
|> --------------------------------------------------------------------------

Theoretically, they should only need to recompile.  The Alpha's can not run
hp code, they are two separate RISC architectures.  As far as sharing data
goes, there you have a compatability.  If you expect to share data you may
need to write a conversion program, unless data is stored as ascii text, or 
you are using a database product that can handle a multivendor environment.

Bruce
-- 
  /
 / -----------------------------------------------------------------------
 | Bruce F. Gordon                       INTERNET:  gordon_b@apollo.hp.com
  \ Technical Consultant
 O \__ Hewlett Packard                   VOICE:     (508) 436-4621
  \/  | 300 Apollo Drive                 FAX:       (508) 436-5142
  u-  | Chelmsford, MA 01824
    \_| ------------------------------------------------------------------
      |
       |


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: big endian and little endian
  1994-12-06 19:17 big endian and little endian Massimo Macucci
  1994-12-06 20:24 ` Steve Lionel
  1994-12-06 21:26 ` Bruce Gordon
@ 1994-12-06 23:02 ` Stephen Hoffman
  1994-12-09 15:31   ` Robert Hickler
  2 siblings, 1 reply; 7+ messages in thread
From: Stephen Hoffman @ 1994-12-06 23:02 UTC (permalink / raw)



In article <3c2dc6$8po@serra.unipi.it>, ferrovia@pimac2.iet.unipi.it (Massimo Macucci) writes:
|>This might be in the FAQ, but I have not been able to retrieve it.
|>A group here has developed applications on hp workstations, which are
|>"different" endian with respect to the Alphas. Now they would like 
|>to switch to the new Alphas, but they have the problem that binary
|>files cannot be exchanged between the hp's and the Alphas due to the 
|>different byte ordering.
|>Does anybody know a good solution for this problem, except for the 
|>obvious one of rewriting the application ?
|>                                         Massimo Macucci                      

  I know of no general purpose conversion tool.  It's easy to code
  the simple case(s), but a tool that handled the general case would
  appear to be a hairy problem in file description specification and
  parsing...

  If working in C on OSF/1, there are htonl() and ntohl() routines,
  and (if I remember correctly) xdr.  HP likely supports both, so
  using the same source code on both platforms appears possible.

  Alpha floating point is little-endian IEEE.  Not sure about HP, but
  I would suspect it's big-endian IEEE format.  (Simple conversion.)

  Conversions can also be avoided (obviously) if ASCII-format files are
  used.

  ------------------------------ Opinionative -------------------------------
   Stephen Hoffman, NREMT-I, N1THN               hoffman@xdelta.enet.dec.com
        OpenVMS Engineering, Digital Equipment Corporation, Nashua NH



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: big endian and little endian
  1994-12-06 20:24 ` Steve Lionel
@ 1994-12-06 23:18   ` Andrew Gallatin
  0 siblings, 0 replies; 7+ messages in thread
From: Andrew Gallatin @ 1994-12-06 23:18 UTC (permalink / raw)


In article <3c2har$q6n@jac.zko.dec.com>,
Steve Lionel <lionel@quark.enet.dec.com> wrote:
>If the application is in Fortran, they can use the CONVERT='BIG_ENDIAN'
>option in the OPEN statement which will cause DEC Fortran to automatically
>do the byte-swap on input or output.  Otherwise it should be a straightforward
>task to write a program to process the file and do the byte swap as
>necessary.

Alternatively, they could convert their data files using dd & the
conv=swab option:
%dd if=file.hp of=file.dec conv=swab

This is admittedly less transparent, but we used this when moving some
researchers from sparcs to Alphas.

BTW- this is assuming OSF/1.

Drew


##############################################################################
#		Andrew Gallatin, Computer Project Manager                    #
#	    Institute of Statistics and Decision Sciences		     #
#	  Box 90251, Duke University, Durham, NC 27708-0251		     #
##############################################################################


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: big endian and little endian
  1994-12-06 23:02 ` Stephen Hoffman
@ 1994-12-09 15:31   ` Robert Hickler
  1994-12-14 14:32     ` Eric Frey
  0 siblings, 1 reply; 7+ messages in thread
From: Robert Hickler @ 1994-12-09 15:31 UTC (permalink / raw)


In article <3c2qhh$867@jac.zko.dec.com>,
Stephen Hoffman <hoffman@xdelta.enet.dec.com> wrote:
>
>In article <3c2dc6$8po@serra.unipi.it>, ferrovia@pimac2.iet.unipi.it (Massimo Macucci) writes:
>|>files cannot be exchanged between the hp's and the Alphas due to the 
>|>different byte ordering.
>|>Does anybody know a good solution for this problem, except for the 
>|>obvious one of rewriting the application ?
>|>                                         Massimo Macucci                      
>
>  I know of no general purpose conversion tool.  It's easy to code
>  the simple case(s), but a tool that handled the general case would
>  appear to be a hairy problem in file description specification and
>  parsing...
Accelr8 has a commercial general purpose tool called Open TRANSL8 that handles
byte swapping (and VAX <--> IEEE floating point) conversion.  It is
driven by a file specification.  Send mail if you want to know more.
>
>  If working in C on OSF/1, there are htonl() and ntohl() routines,
>  and (if I remember correctly) xdr.  HP likely supports both, so
>  using the same source code on both platforms appears possible.
>
>  Alpha floating point is little-endian IEEE.  Not sure about HP, but
>  I would suspect it's big-endian IEEE format.  (Simple conversion.)
True.
>
>  Conversions can also be avoided (obviously) if ASCII-format files are
>  used.
True again.
>
>  ------------------------------ Opinionative -------------------------------
>   Stephen Hoffman, NREMT-I, N1THN               hoffman@xdelta.enet.dec.com
>        OpenVMS Engineering, Digital Equipment Corporation, Nashua NH
>
Robert Hickler                            Tel   (303) 863-8088 
robert@accelr8.com                        Fax   (303) 863-1218
       Open Software Solutions(tm) from Accelr8 Technology 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: big endian and little endian
  1994-12-09 15:31   ` Robert Hickler
@ 1994-12-14 14:32     ` Eric Frey
  0 siblings, 0 replies; 7+ messages in thread
From: Eric Frey @ 1994-12-14 14:32 UTC (permalink / raw)


In article <3c2rfu$bcu@news.duke.edu> Andrew Gallatin,
gallatin@isds.duke.edu writes:
>Alternatively, they could convert their data files using dd & the
>conv=swab option:
>%dd if=file.hp of=file.dec conv=swab
>
I really don't think swab will work for float or 4 byte integers. This
swaps every other pair of bytes, which is o.k. for 2 byte integers. For 4
byte data elements such (integer and float) you need to swap things as
follows:
1,2,3,4->4,3,2,1
This is the way we've been doing swaps between various little endian
(mips, alpha) and
big endian (hp, sun, stardent) platforms for a long time.

Eric Frey
UNC-CH Biomed. Eng.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~1994-12-14 14:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1994-12-06 19:17 big endian and little endian Massimo Macucci
1994-12-06 20:24 ` Steve Lionel
1994-12-06 23:18   ` Andrew Gallatin
1994-12-06 21:26 ` Bruce Gordon
1994-12-06 23:02 ` Stephen Hoffman
1994-12-09 15:31   ` Robert Hickler
1994-12-14 14:32     ` Eric Frey

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