diff options
author | Chris Johns <chrisj@rtems.org> | 2012-11-29 19:04:12 +1100 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2012-11-29 19:04:12 +1100 |
commit | 5c716ef1d1ed1962ffe2470a6d702759718f9875 (patch) | |
tree | 0c711871a387fa1047bb1570edd5fcd742525dc5 /rld-compression.h | |
parent | 51be43d7946da7a545fb7ee91fb94a79bb1b186a (diff) |
Compress as blocks.
The LZ77 compressor works with blocks. Each block is prefixed with
a header that defines the output size of the block being compressed.
Diffstat (limited to 'rld-compression.h')
-rw-r--r-- | rld-compression.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/rld-compression.h b/rld-compression.h index c6370dc..accc177 100644 --- a/rld-compression.h +++ b/rld-compression.h @@ -93,6 +93,14 @@ namespace rld size_t compressed () const; private: + + /** + * Output the block of data to the output file with the block header. + * + * @param forced If true output the buffer. + */ + void output (bool forced = false); + files::image& image; //< The image to read or write to or from. size_t size; //< The size of the buffer. bool compress; //< If true compress the data. @@ -114,7 +122,7 @@ namespace rld uint8_t bytes[sizeof (T)]; T v = value; int b = sizeof (T) - 1; - while (b > 0) + while (b >= 0) { bytes[b--] = (uint8_t) v; v >>= 8; |