LZLookupTable: Default-initialize class members directly in the class

Same thing without the need to duplicate the variable name.
This commit is contained in:
Lioncash 2019-08-15 23:45:14 -04:00
parent 3092dc79e7
commit f7b8c33ed2
2 changed files with 4 additions and 9 deletions

View File

@ -24,8 +24,8 @@ public:
private: private:
typedef std::multimap<std::vector<uint8_t>, int32_t> LookupTable; typedef std::multimap<std::vector<uint8_t>, int32_t> LookupTable;
LookupTable table; LookupTable table;
atInt32 m_minimumMatch; atInt32 m_minimumMatch = 3;
atInt32 m_slidingWindow; atInt32 m_slidingWindow = 4096;
atInt32 m_lookAheadWindow; atInt32 m_lookAheadWindow = 18;
std::vector<uint8_t> m_buffer; std::vector<uint8_t> m_buffer;
}; };

View File

@ -1,12 +1,7 @@
#include "LZ77/LZLookupTable.hpp" #include "LZ77/LZLookupTable.hpp"
#include <algorithm> #include <algorithm>
LZLookupTable::LZLookupTable() { LZLookupTable::LZLookupTable() : m_buffer(m_minimumMatch) {}
m_minimumMatch = 3;
m_slidingWindow = 4096;
m_lookAheadWindow = 18;
m_buffer.resize(m_minimumMatch);
}
LZLookupTable::LZLookupTable(atInt32 minimumMatch, atInt32 slidingWindow, atInt32 lookAheadWindow) { LZLookupTable::LZLookupTable(atInt32 minimumMatch, atInt32 slidingWindow, atInt32 lookAheadWindow) {
if (minimumMatch > 0) if (minimumMatch > 0)