Make LZ4 Decompressor return a state value

This commit is contained in:
2022-12-29 13:25:48 +01:00
parent fa993cc63e
commit 3554394e11
3 changed files with 25 additions and 12 deletions

View File

@@ -6,10 +6,21 @@
namespace JabyEngine {
class LZ4Decompressor {
public:
enum struct Result {
InProgress = 0,
Done,
Error
struct Result {
Progress progress;
size_t bytes_ready;
static constexpr Result new_error() {
return {Progress::Error, 0};
}
static constexpr Result new_done(size_t bytes_ready) {
return {Progress::Done, bytes_ready};
}
static constexpr Result new_in_progress(size_t bytes_ready) {
return {Progress::InProgress, bytes_ready};
}
};
private:
@@ -28,7 +39,7 @@ namespace JabyEngine {
void setup(uint8_t* dst_adr);
void reset();
Progress process(const uint8_t* data, size_t size);
Result process(const uint8_t* data, size_t size);
};
}