23
23
24
24
#include < prevector.h>
25
25
#include < span.h>
26
- #include < util/types.h>
27
26
28
27
/* *
29
28
* 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)
123
122
s.read ((char *)&obj, 8 );
124
123
return le64toh (obj);
125
124
}
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
- }
140
125
141
126
142
127
// ///////////////////////////////////////////////////////////////
@@ -221,8 +206,6 @@ template<typename Stream> inline void Serialize(Stream& s, int32_t a ) { ser_wri
221
206
template <typename Stream> inline void Serialize (Stream& s, uint32_t a) { ser_writedata32 (s, a); }
222
207
template <typename Stream> inline void Serialize (Stream& s, int64_t a ) { ser_writedata64 (s, a); }
223
208
template <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)); }
226
209
template <typename Stream, int N> inline void Serialize (Stream& s, const char (&a)[N]) { s.write (a, N); }
227
210
template <typename Stream, int N> inline void Serialize (Stream& s, const unsigned char (&a)[N]) { s.write (CharCast (a), N); }
228
211
template <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 =
239
222
template <typename Stream> inline void Unserialize (Stream& s, uint32_t & a) { a = ser_readdata32 (s); }
240
223
template <typename Stream> inline void Unserialize (Stream& s, int64_t & a ) { a = ser_readdata64 (s); }
241
224
template <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)); }
244
225
template <typename Stream, int N> inline void Unserialize (Stream& s, char (&a)[N]) { s.read (a, N); }
245
226
template <typename Stream, int N> inline void Unserialize (Stream& s, unsigned char (&a)[N]) { s.read (CharCast (a), N); }
246
227
template <typename Stream> inline void Unserialize (Stream& s, Span<unsigned char >& span) { s.read (CharCast (span.data ()), span.size ()); }
0 commit comments