DSPAssembler: In-class initialize members where applicable

Avoids repeating ourself in the initializer list and makes the class
have a predictable initial state.
This commit is contained in:
Lioncash 2018-06-18 15:35:56 -04:00
parent 091efcc41d
commit 1389bf35bd
2 changed files with 10 additions and 12 deletions

View File

@ -51,9 +51,7 @@ static const char* err_string[] = {"",
"Number out of range", "Number out of range",
"Program counter out of range"}; "Program counter out of range"};
DSPAssembler::DSPAssembler(const AssemblerSettings& settings) DSPAssembler::DSPAssembler(const AssemblerSettings& settings) : settings_(settings)
: m_cur_addr(0), m_cur_pass(0), m_current_param(0), settings_(settings)
{ {
} }

View File

@ -107,23 +107,23 @@ private:
std::string include_dir; std::string include_dir;
std::string cur_line; std::string cur_line;
u32 m_cur_addr; u32 m_cur_addr = 0;
int m_totalSize; int m_totalSize = 0;
u8 m_cur_pass; u8 m_cur_pass = 0;
LabelMap labels; LabelMap labels;
u32 code_line; u32 code_line = 0;
bool failed; bool failed = false;
std::string last_error_str; std::string last_error_str;
AssemblerError last_error; AssemblerError last_error = AssemblerError::OK;
typedef std::map<std::string, std::string> AliasMap; typedef std::map<std::string, std::string> AliasMap;
AliasMap aliases; AliasMap aliases;
segment_t cur_segment; segment_t cur_segment = SEGMENT_CODE;
u32 segment_addr[SEGMENT_MAX]; u32 segment_addr[SEGMENT_MAX] = {};
int m_current_param; int m_current_param = 0;
const AssemblerSettings settings_; const AssemblerSettings settings_;
}; };
} // namespace DSP } // namespace DSP