Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* OFF-TOPIC: little-endian vs. big-endian conversion
@ 1998-04-03 17:15 Janice McCarthy
  1998-04-03 17:33 ` Uncle George
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Janice McCarthy @ 1998-04-03 17:15 UTC (permalink / raw)
  To: axp-list


Hello all!  I know this is off-topic, but I am getting desperate.  I have 
some binary files that were generated on an sgi, but I need to read them 
on my Alpha (UDB with linux 2.0.20).  I have learned that the sgi is 
big-endian, where the alpha is little-endian.  The files are in the 
following format:

1 int followed by 52 doubles - repeated 20,000 times.

I wrote a conversion program to reverse the bytes, but it doesn't seem to 
work.  Am I missing something?  Is there more of a difference between the 
two conventions?  Can someone at least point me in the right direction?  
There was at one time a mini-how-to, but it seems to have disappeared!

Thanks in advance,

Janice McCarthy
janice@acpub.duke.edu


^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: OFF-TOPIC: little-endian vs. big-endian conversion
@ 1998-04-03 17:27 Greg Lindahl
  1998-04-03 17:51 ` Michal Jaegermann
  0 siblings, 1 reply; 7+ messages in thread
From: Greg Lindahl @ 1998-04-03 17:27 UTC (permalink / raw)
  To: axp-list

> Hello all!  I know this is off-topic, but I am getting desperate.  I have 
> some binary files that were generated on an sgi, but I need to read them 
> on my Alpha (UDB with linux 2.0.20).  I have learned that the sgi is 
> big-endian, where the alpha is little-endian.  The files are in the 
> following format:
> 
> 1 int followed by 52 doubles - repeated 20,000 times.

Is this an unformatted fortran file? In which case, the format is:

record length
data
repeat record length

On the SGI and Digital Unix, the record length is a 32 bit int. On the
latest f2c libraries, it's 64 bits. You have to account for this.

-- g


^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: OFF-TOPIC: little-endian vs. big-endian conversion
@ 1998-04-03 17:54 Greg Lindahl
  0 siblings, 0 replies; 7+ messages in thread
From: Greg Lindahl @ 1998-04-03 17:54 UTC (permalink / raw)
  To: axp-list

> > On the
> > latest f2c libraries, it's 64 bits. You have to account for this.
> 
> It depends when they are coming from.  If they are from the current g77
> then f2c.h defines there, correctly I would argue, Fortran 'integer'
> type as 'int' - i.e. 32 bits.

The size of a Fortran integer is different from the size of the
Fortran record length. The latest g77 for alphas (egcs) has
these as 32 and 64 bits, respectively.

I think the record length size should be settable per-file at runtime,
but no one's done that yet.

-- g


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

end of thread, other threads:[~1998-04-06 13:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-04-03 17:15 OFF-TOPIC: little-endian vs. big-endian conversion Janice McCarthy
1998-04-03 17:33 ` Uncle George
1998-04-03 17:54 ` Alvin Starr
1998-04-06 12:39 ` Mike Howard
  -- strict thread matches above, loose matches on Subject: below --
1998-04-03 17:27 Greg Lindahl
1998-04-03 17:51 ` Michal Jaegermann
1998-04-03 17:54 Greg Lindahl

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