diff options
author | Max Kellermann <max@duempel.org> | 2013-10-28 23:29:23 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-10-28 23:29:23 +0100 |
commit | 0ad2eb34c74dc128e7884552ef1f930f3f495066 (patch) | |
tree | 58d66124d2922730ba2bff0bd659c0f6e9b4fad5 /src/decoder/DsdLib.hxx | |
parent | 0e8a15e813611af3c96f765386c94c7fc5f9343d (diff) | |
download | mpd-0ad2eb34c74dc128e7884552ef1f930f3f495066.tar.gz mpd-0ad2eb34c74dc128e7884552ef1f930f3f495066.tar.xz mpd-0ad2eb34c74dc128e7884552ef1f930f3f495066.zip |
decoder/dsdlib: add class DsdUint64
Merge lots of duplicate code.
Diffstat (limited to '')
-rw-r--r-- | src/decoder/DsdLib.hxx | 12 |
1 files changed, 12 insertions, 0 deletions
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 <stddef.h> @@ -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); |