diff options
author | Pieter Wuille <pieter@wuille.net> | 2021-05-18 12:37:02 -0700 |
---|---|---|
committer | Pieter Wuille <pieter@wuille.net> | 2021-05-24 16:15:05 -0700 |
commit | 66545da2008cd9e806e41b74522ded259cd64f86 (patch) | |
tree | 0e735db6f3914d8938549e16ca55305b2535df5b /src/serialize.h | |
parent | fff1cae43af959a601cf2558cb3c77f3c2b1aa80 (diff) |
Remove support for double serialization
Diffstat (limited to 'src/serialize.h')
-rw-r--r-- | src/serialize.h | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/src/serialize.h b/src/serialize.h index 276f643c7f..5ef846b9e9 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -23,7 +23,6 @@ #include <prevector.h> #include <span.h> -#include <util/types.h> /** * 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) s.read((char*)&obj, 8); return le64toh(obj); } -inline uint64_t ser_double_to_uint64(double x) -{ - uint64_t tmp; - std::memcpy(&tmp, &x, sizeof(x)); - static_assert(sizeof(tmp) == sizeof(x), "double and uint64_t assumed to have the same size"); - return tmp; -} -inline double ser_uint64_to_double(uint64_t y) -{ - double tmp; - std::memcpy(&tmp, &y, sizeof(y)); - static_assert(sizeof(tmp) == sizeof(y), "double and uint64_t assumed to have the same size"); - return tmp; -} ///////////////////////////////////////////////////////////////// @@ -221,8 +206,6 @@ template<typename Stream> inline void Serialize(Stream& s, int32_t a ) { ser_wri template<typename Stream> inline void Serialize(Stream& s, uint32_t a) { ser_writedata32(s, a); } template<typename Stream> inline void Serialize(Stream& s, int64_t a ) { ser_writedata64(s, a); } template<typename Stream> inline void Serialize(Stream& s, uint64_t a) { ser_writedata64(s, a); } -template<typename Stream> inline void Serialize(Stream& s, float a ) { static_assert(ALWAYS_FALSE<Stream>, "Not implemented"); } -template<typename Stream> inline void Serialize(Stream& s, double a ) { ser_writedata64(s, ser_double_to_uint64(a)); } template<typename Stream, int N> inline void Serialize(Stream& s, const char (&a)[N]) { s.write(a, N); } template<typename Stream, int N> inline void Serialize(Stream& s, const unsigned char (&a)[N]) { s.write(CharCast(a), N); } 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 = template<typename Stream> inline void Unserialize(Stream& s, uint32_t& a) { a = ser_readdata32(s); } template<typename Stream> inline void Unserialize(Stream& s, int64_t& a ) { a = ser_readdata64(s); } template<typename Stream> inline void Unserialize(Stream& s, uint64_t& a) { a = ser_readdata64(s); } -template<typename Stream> inline void Unserialize(Stream& s, float& a ) { static_assert(ALWAYS_FALSE<Stream>, "Not implemented"); } -template<typename Stream> inline void Unserialize(Stream& s, double& a ) { a = ser_uint64_to_double(ser_readdata64(s)); } template<typename Stream, int N> inline void Unserialize(Stream& s, char (&a)[N]) { s.read(a, N); } template<typename Stream, int N> inline void Unserialize(Stream& s, unsigned char (&a)[N]) { s.read(CharCast(a), N); } template<typename Stream> inline void Unserialize(Stream& s, Span<unsigned char>& span) { s.read(CharCast(span.data()), span.size()); } |