Mega-cleanup for atomic_t<> and named bit-sets bs_t<>

Remove "atomic operator" classes
Remove test, test_and_set, test_and_reset, test_and_complement global functions
Simplify atomic_t<> with constexpr if, remove some garbage
Redesign bs_t<> to use class, mark its methods constexpr
Implement atomic_bs_t<> for optimizations
Remove unused __bitwise_ops concept (should be in other header anyway)
Bitsets can now be tested via safe bool conversion
This commit is contained in:
Nekotekina 2018-09-02 20:22:35 +03:00
parent a6d06b2e20
commit 8abe6489ed
23 changed files with 604 additions and 1090 deletions

View file

@ -112,7 +112,7 @@ debugger_frame::debugger_frame(std::shared_ptr<gui_settings> settings, QWidget *
{
if (m_btn_run->text() == RunString && cpu->state.test_and_reset(cpu_flag::dbg_pause))
{
if (!test(cpu->state, cpu_flag::dbg_pause + cpu_flag::dbg_global_pause))
if (!(cpu->state & (cpu_flag::dbg_pause + cpu_flag::dbg_global_pause)))
{
cpu->notify();
}
@ -293,7 +293,7 @@ void debugger_frame::UpdateUI()
m_last_stat = static_cast<u32>(state);
DoUpdate();
if (test(state & cpu_flag::dbg_pause))
if (state & cpu_flag::dbg_pause)
{
m_btn_run->setText(RunString);
m_btn_step->setEnabled(true);
@ -570,13 +570,13 @@ void debugger_frame::DoStep(bool stepOver)
{
bool should_step_over = stepOver && cpu->id_type() == 1;
if (test(cpu_flag::dbg_pause, cpu->state.fetch_op([&](bs_t<cpu_flag>& state)
if (+cpu_flag::dbg_pause & +cpu->state.fetch_op([&](bs_t<cpu_flag>& state)
{
if (!should_step_over)
state += cpu_flag::dbg_step;
state -= cpu_flag::dbg_pause;
})))
}))
{
if (should_step_over)
{
@ -592,7 +592,7 @@ void debugger_frame::DoStep(bool stepOver)
{
m_breakpoint_handler->RemoveBreakpoint(next_instruction_pc);
}
m_last_step_over_breakpoint = next_instruction_pc;
}