From 0ad2eb34c74dc128e7884552ef1f930f3f495066 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 28 Oct 2013 23:29:23 +0100 Subject: decoder/dsdlib: add class DsdUint64 Merge lots of duplicate code. --- src/decoder/DsdLib.hxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/decoder/DsdLib.hxx') diff --git a/src/decoder/DsdLib.hxx b/src/decoder/DsdLib.hxx index 6b7498df1..25329e650 100644 --- a/src/decoder/DsdLib.hxx +++ b/src/decoder/DsdLib.hxx @@ -20,6 +20,7 @@ #ifndef MPD_DECODER_DSDLIB_HXX #define MPD_DECODER_DSDLIB_HXX +#include "system/ByteOrder.hxx" #include "Compiler.h" #include @@ -35,6 +36,17 @@ struct DsdId { bool Equals(const char *s) const; }; +class DsdUint64 { + uint32_t lo; + uint32_t hi; + +public: + constexpr uint64_t Read() const { + return (uint64_t(FromLE32(hi)) << 32) | + uint64_t(FromLE32(lo)); + } +}; + bool dsdlib_read(Decoder *decoder, InputStream &is, void *data, size_t length); -- cgit v1.2.3