Serializing floats

Adam D. Moss adam at gimp.org
Sat Jan 21 06:38:29 EST 2006


Hi!

After years of spurning PHYSFS_writeSLE32() and
friends, I seem to have suddenly found myself
using them.

At the same time, however, I find myself needing
to de/serialize floats in a similar 'portable' way.
I know that this is really tough as a general case,
but if you can assume IEEE floats then the only
serialization issue is endianness - right?

So could we have a PHYSFS_writefloat32() function or
is it a reasonable assumption (I suspect not) that float
endianness matches int endianness and we can fake it
by passing a type-punned float to PHYSFS_writeSLE32()?
(**ick**)

Regards,
--Adam
-- 
Adam D. Moss   -   adam at gimp.org



More information about the physfs mailing list