diff options
-rw-r--r-- | include/object/xdrstream.h | 2 | ||||
-rw-r--r-- | src/os/object/xdrstream.cc | 12 |
2 files changed, 14 insertions, 0 deletions
diff --git a/include/object/xdrstream.h b/include/object/xdrstream.h index 497e143..55bef5b 100644 --- a/include/object/xdrstream.h +++ b/include/object/xdrstream.h @@ -27,6 +27,8 @@ class XDRStream { XDRStream & operator<<(int32_t number); XDRStream & operator<<(uint64_t number); XDRStream & operator<<(int64_t number); + XDRStream & operator<<(float number); + XDRStream & operator<<(double number); XDRStream & operator<<(char const *text); template<uint32_t TSize> XDRStream & operator<<(char const (&text)[TSize]); XDRStream & operator<<(XDRStream & (*fun) (XDRStream &)); diff --git a/src/os/object/xdrstream.cc b/src/os/object/xdrstream.cc index bc2ad89..888153b 100644 --- a/src/os/object/xdrstream.cc +++ b/src/os/object/xdrstream.cc @@ -68,6 +68,18 @@ XDRStream & XDRStream::operator<<(int64_t number) return *this; } +XDRStream & XDRStream::operator<<(float number) +{ + *this << *(uint32_t*)&number; + return *this; +} + +XDRStream & XDRStream::operator<<(double number) +{ + *this << *(uint64_t*)&number; + return *this; +} + XDRStream & XDRStream::operator<<(char const *data){ if (!is_fixed_length) { *this << next_array_len; |