Make LZ4 Decompressor return a state value
This commit is contained in:
@@ -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);
|
||||
};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user