2323
2424#include < prevector.h>
2525#include < span.h>
26- #include < util/types.h>
2726
2827/* *
2928 * The maximum size of a serialized object in bytes or number of elements
@@ -123,20 +122,6 @@ template<typename Stream> inline uint64_t ser_readdata64(Stream &s)
123122 s.read ((char *)&obj, 8 );
124123 return le64toh (obj);
125124}
126- inline uint64_t ser_double_to_uint64 (double x)
127- {
128- uint64_t tmp;
129- std::memcpy (&tmp, &x, sizeof (x));
130- static_assert (sizeof (tmp) == sizeof (x), " double and uint64_t assumed to have the same size" );
131- return tmp;
132- }
133- inline double ser_uint64_to_double (uint64_t y)
134- {
135- double tmp;
136- std::memcpy (&tmp, &y, sizeof (y));
137- static_assert (sizeof (tmp) == sizeof (y), " double and uint64_t assumed to have the same size" );
138- return tmp;
139- }
140125
141126
142127// ///////////////////////////////////////////////////////////////
@@ -221,8 +206,6 @@ template<typename Stream> inline void Serialize(Stream& s, int32_t a ) { ser_wri
221206template <typename Stream> inline void Serialize (Stream& s, uint32_t a) { ser_writedata32 (s, a); }
222207template <typename Stream> inline void Serialize (Stream& s, int64_t a ) { ser_writedata64 (s, a); }
223208template <typename Stream> inline void Serialize (Stream& s, uint64_t a) { ser_writedata64 (s, a); }
224- template <typename Stream> inline void Serialize (Stream& s, float a ) { static_assert (ALWAYS_FALSE<Stream>, " Not implemented" ); }
225- template <typename Stream> inline void Serialize (Stream& s, double a ) { ser_writedata64 (s, ser_double_to_uint64 (a)); }
226209template <typename Stream, int N> inline void Serialize (Stream& s, const char (&a)[N]) { s.write (a, N); }
227210template <typename Stream, int N> inline void Serialize (Stream& s, const unsigned char (&a)[N]) { s.write (CharCast (a), N); }
228211template <typename Stream> inline void Serialize (Stream& s, const Span<const unsigned char >& span) { s.write (CharCast (span.data ()), span.size ()); }
@@ -239,8 +222,6 @@ template<typename Stream> inline void Unserialize(Stream& s, int32_t& a ) { a =
239222template <typename Stream> inline void Unserialize (Stream& s, uint32_t & a) { a = ser_readdata32 (s); }
240223template <typename Stream> inline void Unserialize (Stream& s, int64_t & a ) { a = ser_readdata64 (s); }
241224template <typename Stream> inline void Unserialize (Stream& s, uint64_t & a) { a = ser_readdata64 (s); }
242- template <typename Stream> inline void Unserialize (Stream& s, float & a ) { static_assert (ALWAYS_FALSE<Stream>, " Not implemented" ); }
243- template <typename Stream> inline void Unserialize (Stream& s, double & a ) { a = ser_uint64_to_double (ser_readdata64 (s)); }
244225template <typename Stream, int N> inline void Unserialize (Stream& s, char (&a)[N]) { s.read (a, N); }
245226template <typename Stream, int N> inline void Unserialize (Stream& s, unsigned char (&a)[N]) { s.read (CharCast (a), N); }
246227template <typename Stream> inline void Unserialize (Stream& s, Span<unsigned char >& span) { s.read (CharCast (span.data ()), span.size ()); }
0 commit comments