Byte ordering
Ed Hill
ed@eh3.com
Tue Sep 30 15:23:00 GMT 2003
On Tue, 2003-09-30 at 10:58, Z F wrote:
> Hello,
>
> Thank you Pedro for your reply, but I realized I was not clear.
> double is an 8-byte quantity (at least on intel) so I need
> 64-bit-swapping routines not 32-bit ones which are available.
> Also, htonl() and ntohl() are for ints. I could cast double to int but
> this would require splitting the double into two parts mantissa and
> exponent and applying 32-bit swaps independently. Is this the way to
> go?
>
> Need more input :-)
Hi Lazar,
Your problem is old "little-endian" (sometimes called "ieee-le") versus
"big-endian" (aka "ieee-be" or "network order") byte-ordering format.
Theres a lot of literature on the web and even some free tools/libraries
to help you do conversions between the two. Just enter the above terms
into google and you'll get numerous references such as:
http://www.cs.umass.edu/~verts/cs32/endian.html
http://info.astrian.net/jargon/terms/l/little-endian.html
http://www.tacc.utexas.edu/resources/user_guides/porting/
hth,
Ed
--
Edward H. Hill III, PhD
office: MIT Dept. of EAPS; Room 54-1424; 77 Massachusetts Ave.
Cambridge, MA 02139-4307
email: eh3@mit.edu, ed@eh3.com
URL: http://web.mit.edu/eh3/
phone: 617-253-0098
fax: 617-253-4464
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://sourceware.org/pipermail/gsl-discuss/attachments/20030930/ba6fe391/attachment.sig>
More information about the Gsl-discuss
mailing list