diff --git a/src/Compression.cc b/src/Compression.cc index 06cc7d6a..34d50e92 100644 --- a/src/Compression.cc +++ b/src/Compression.cc @@ -169,12 +169,11 @@ struct WindowIndex { } }; -template struct LZSSInterleavedWriter { StringWriter w; size_t buf_offset; uint8_t next_control_bit; - uint8_t buf[(MaxDataBytesPerControlBit * 8) + 1]; + uint8_t buf[0x19]; LZSSInterleavedWriter() : buf_offset(1), @@ -423,7 +422,7 @@ string prs_compress_optimal( } // Produce the PRS command stream from the shortest path - LZSSInterleavedWriter<3> w; + LZSSInterleavedWriter w; last_progress_fn_call = static_cast(-1); for (size_t offset = 0; offset < in_size;) { if ((offset & ~0xFFF) != (last_progress_fn_call & ~0xFFF)) { @@ -725,7 +724,7 @@ string prs_compress( string prs_compress(const void* in_data_v, size_t in_size, function progress_fn) { const uint8_t* in_data = reinterpret_cast(in_data_v); - LZSSInterleavedWriter<3> w; + LZSSInterleavedWriter w; WindowIndex<0x1FFF, 0x100, true> window(in_data_v, in_size); size_t last_progress_fn_call_offset = 0; @@ -1114,7 +1113,7 @@ string bc0_compress_optimal( } // Produce the BC0 command stream from the shortest path - LZSSInterleavedWriter<3> w; + LZSSInterleavedWriter w; last_progress_fn_call = static_cast(-1); for (size_t offset = 0; offset < in_size;) { if ((offset & ~0xFFF) != (last_progress_fn_call & ~0xFFF)) { @@ -1147,7 +1146,7 @@ string bc0_compress(const string& data, function progress_ string bc0_compress(const void* in_data_v, size_t in_size, function progress_fn) { const uint8_t* in_data = reinterpret_cast(in_data_v); - LZSSInterleavedWriter<2> w; + LZSSInterleavedWriter w; WindowIndex<0x1000, 0x12> window(in_data_v, in_size); size_t last_progress_fn_call_offset = 0; @@ -1185,7 +1184,7 @@ string bc0_compress(const void* in_data_v, size_t in_size, function(in_data_v); - LZSSInterleavedWriter<1> w; + LZSSInterleavedWriter w; for (size_t z = 0; z < in_size; z++) { w.write_control(true); w.write_data(in_data[z]);