This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Byte ordering


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

Attachment: signature.asc
Description: This is a digitally signed message part


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]