Serializing floats

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


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()?

Adam D. Moss   -   adam at

More information about the physfs mailing list