Commit 0a4a3e08 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

XDRStream: Support float/double

parent 3b660dbb
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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 &));
+12 −0
Original line number Diff line number Diff line
@@ -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;