decoder/dsdlib: add class DsdUint64

Merge lots of duplicate code.
This commit is contained in:
Max Kellermann
2013-10-28 23:29:23 +01:00
parent 0e8a15e813
commit 0ad2eb34c7
3 changed files with 26 additions and 25 deletions

View File

@@ -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);