summaryrefslogtreecommitdiff
path: root/src/os/object/xdrstream.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/os/object/xdrstream.cc')
-rw-r--r--src/os/object/xdrstream.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/os/object/xdrstream.cc b/src/os/object/xdrstream.cc
index 888153b..ad708be 100644
--- a/src/os/object/xdrstream.cc
+++ b/src/os/object/xdrstream.cc
@@ -70,13 +70,23 @@ XDRStream & XDRStream::operator<<(int64_t number)
XDRStream & XDRStream::operator<<(float number)
{
- *this << *(uint32_t*)&number;
+ union {
+ uint32_t i;
+ float f;
+ } v;
+ v.f = number;
+ *this << v.i;
return *this;
}
XDRStream & XDRStream::operator<<(double number)
{
- *this << *(uint64_t*)&number;
+ union {
+ uint64_t i;
+ double d;
+ } v;
+ v.d = number;
+ *this << v.i;
return *this;
}