Re: Big/little endian conversion



Gianni Mariani <gi2nospam@xxxxxxxxxx> writes:

> David Schwartz wrote:
>> "Gianni Mariani" <gi2nospam@xxxxxxxxxx> wrote in message
> ...
>> Why? When you can write clearer, easier to understand and
>> maintain code that will work regardless of the system's native
>> format. What's the advantage?
>
> Little endian and big endian are well defined for integral types. Is
> there a clear spec for IEEE formatted floating point representations ?

Yes.

The question is whether the target processor/compiler respect them.

Actually, I don't remember any bytesex consideration in the IEEE stuff
I read.

I assume an abstract bit field is used to encode an IEEE floating
point number, and some processors choose to store this bit field as a
bytesexed integer instead of storing the bits in the same order as the
others.


> So, if I was too lazy to look it up (which I usually am), the code
> posted by Bjorn Reese would work.
>
> In Bjorn's code, the knowledge of how the floating point layout works
> is extracted from the compiler itself.
>
> I'll take back my previous comment on being able to find broken
> assumtions by a few judicios assert calls.


--
__Pascal Bourguignon__ http://www.informatimago.com/

"You question the worthiness of my code? I should kill you where you
stand!"
.