From: David Hawkins <dwh@ovro•caltech.edu>
To: Mirek23 <miroslaw.dach@psi•ch>
Cc: linuxppc-embedded@ozlabs•org
Subject: Re: Problem with 64-bit variables on ppc405
Date: Mon, 19 Nov 2007 12:46:15 -0800 [thread overview]
Message-ID: <4741F617.9080408@ovro.caltech.edu> (raw)
In-Reply-To: <13844837.post@talk.nabble.com>
Hi Mirek,
> Doubles and long long are 8 bytes long but the byte order differs
> on my host linux Intel PC from this what I have on the target
> linux ppc 405.
That would be due to the difference in endianness of the
processors.
http://en.wikipedia.org/wiki/Endianness
If you want to work on data on both an Intel machine, and a
PowerPC, then you have to transfer the data between the machines
using a machine-independent binary format.
There are several around:
1. Network byte order = big-endian.
2. XDR
http://en.wikipedia.org/wiki/External_Data_Representation
used by NFS,
3. Common Data Representation
http://en.wikipedia.org/wiki/Common_Data_Representation
Which is implemented in the ACE C++ library.
The nice thing about CDR is that the 'reader makes right',
so its only when the endianness of the reader is different
that it has to use CPU cycles to reformat the data.
Its not only processors that have subtle endian issues.
I use little-endian x86 host CPUs in a little-endian PCI
backplane talking to big-endian PowerPC processors.
Data transferred between the processors is first encoded
into a CDR data stream and then decoded. I write binary
data files using the same stream formatters, and then
use mex routines written in C++ to pull the data into
MATLAB data structures.
MATLAB data files are also an example of a machine independent
binary format. But I don't use them.
Cheers,
Dave
prev parent reply other threads:[~2007-11-19 20:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-19 20:37 Problem with 64-bit variables on ppc405 Mirek23
2007-11-19 20:46 ` David Hawkins [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4741F617.9080408@ovro.caltech.edu \
--to=dwh@ovro$(echo .)caltech.edu \
--cc=linuxppc-embedded@ozlabs$(echo .)org \
--cc=miroslaw.dach@psi$(echo .)ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox