From f7b8c33ed29825fbd33278b3f2faab2537324b98 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 15 Aug 2019 23:45:14 -0400 Subject: [PATCH] LZLookupTable: Default-initialize class members directly in the class Same thing without the need to duplicate the variable name. --- include/LZ77/LZLookupTable.hpp | 6 +++--- src/LZ77/LZLookupTable.cpp | 7 +------ 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/include/LZ77/LZLookupTable.hpp b/include/LZ77/LZLookupTable.hpp index bd66516..6fb4df0 100644 --- a/include/LZ77/LZLookupTable.hpp +++ b/include/LZ77/LZLookupTable.hpp @@ -24,8 +24,8 @@ public: private: typedef std::multimap, int32_t> LookupTable; LookupTable table; - atInt32 m_minimumMatch; - atInt32 m_slidingWindow; - atInt32 m_lookAheadWindow; + atInt32 m_minimumMatch = 3; + atInt32 m_slidingWindow = 4096; + atInt32 m_lookAheadWindow = 18; std::vector m_buffer; }; diff --git a/src/LZ77/LZLookupTable.cpp b/src/LZ77/LZLookupTable.cpp index f2fcea5..83d346d 100644 --- a/src/LZ77/LZLookupTable.cpp +++ b/src/LZ77/LZLookupTable.cpp @@ -1,12 +1,7 @@ #include "LZ77/LZLookupTable.hpp" #include -LZLookupTable::LZLookupTable() { - m_minimumMatch = 3; - m_slidingWindow = 4096; - m_lookAheadWindow = 18; - m_buffer.resize(m_minimumMatch); -} +LZLookupTable::LZLookupTable() : m_buffer(m_minimumMatch) {} LZLookupTable::LZLookupTable(atInt32 minimumMatch, atInt32 slidingWindow, atInt32 lookAheadWindow) { if (minimumMatch > 0)