[clean-list] Serializing Atomic Data Types...
Fabien Todescato
f.todescato@larisys.fr
Thu, 16 Nov 2000 09:23:51 +0100
Dear Cleaners,
Is there an efficient means to convert Reals and Ints to their binary
representation stored in a String, and back ?
In C, provided some care is taken about the byte alignment of structures
member, it is possible to use a union to implement that conversion in
constant time, as is illustrated below.
union {
unsigned long unsignedLong ;
struct {
char byte0 ;
char byte1 ;
char byte2 ;
char byte3 ;
} unsignedLongBytes ;
}
I am considering the implementation of binary serialization of some data
structures, but am stuck for the atomic data types Int and Real...
Thanks...
Fabien TODESCATO
Passenger to Taxi Driver : "Hey, could'nt you go faster, please ?"
Taxi Driver to Passenger : "Sure I could, but the boss told me not to leave
the car."