Re: [linux-audio-user] Re: [linux-audio-dev] [ANN] netjack-0.9rc1

From: stefan kersten <steve@email-addr-hidden-hornz.de>
Date: Tue Mar 14 2006 - 02:15:31 EET

On Tue, Mar 14, 2006 at 12:21:40AM +0100, fons adriaensen wrote:
> OK, but for floats the situation could be more complex. On
> Intel, the exponent/sign byte is the last one. Is it
> always the first one on BE platforms ? If it isn't then
> using ntohl() or htonl() wich are designed to work on
> 32-bit ints will not help.

IEEE 754 defines the layout of a single float:

 1 | 8 | 23 |
 s | e | f |
    |msbit lsbit|msbit lsbit|

from which i'd say the byte order can be derived. the
sign/exponent is in the msb, so it's stored first on BE and
last on LE machines.

> For doubles, things are even more fuzzy. Can you just use
> ntohl() and htonl() on both halves, or do these two have
> to be swapped as well ? Will either rule produce
> consistent results on all platforms ?

doubles are defined similarly; to convert between LE and BE
you have to reverse the bytes or equivalently swap the
reversed 32-bit words.

<sk>
Received on Tue Mar 14 04:15:15 2006

This archive was generated by hypermail 2.1.8 : Tue Mar 14 2006 - 04:15:15 EET