mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-04 05:51:27 +12:00
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:
parent
a6d06b2e20
commit
8abe6489ed
23 changed files with 604 additions and 1090 deletions
|
@ -52,10 +52,10 @@ void cpu_thread::on_task()
|
|||
g_tls_current_cpu_thread = this;
|
||||
|
||||
// Check thread status
|
||||
while (!test(state, cpu_flag::exit + cpu_flag::dbg_global_stop))
|
||||
while (!(state & (cpu_flag::exit + cpu_flag::dbg_global_stop)))
|
||||
{
|
||||
// Check stop status
|
||||
if (!test(state & cpu_flag::stop))
|
||||
if (!(state & cpu_flag::stop))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -100,7 +100,8 @@ cpu_thread::cpu_thread(u32 id)
|
|||
bool cpu_thread::check_state()
|
||||
{
|
||||
#ifdef WITH_GDB_DEBUGGER
|
||||
if (test(state, cpu_flag::dbg_pause)) {
|
||||
if (state & cpu_flag::dbg_pause)
|
||||
{
|
||||
fxm::get<GDBDebugServer>()->pause_from(this);
|
||||
}
|
||||
#endif
|
||||
|
@ -110,7 +111,7 @@ bool cpu_thread::check_state()
|
|||
|
||||
while (true)
|
||||
{
|
||||
if (test(state, cpu_flag::memory) && state.test_and_reset(cpu_flag::memory))
|
||||
if (state & cpu_flag::memory && state.test_and_reset(cpu_flag::memory))
|
||||
{
|
||||
cpu_flag_memory = true;
|
||||
|
||||
|
@ -121,17 +122,17 @@ bool cpu_thread::check_state()
|
|||
}
|
||||
}
|
||||
|
||||
if (test(state, cpu_flag::exit + cpu_flag::dbg_global_stop))
|
||||
if (state & cpu_flag::exit + cpu_flag::dbg_global_stop)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (test(state & cpu_flag::signal) && state.test_and_reset(cpu_flag::signal))
|
||||
if (state & cpu_flag::signal && state.test_and_reset(cpu_flag::signal))
|
||||
{
|
||||
cpu_sleep_called = false;
|
||||
}
|
||||
|
||||
if (!test(state, cpu_state_pause))
|
||||
if (!(state & cpu_state_pause))
|
||||
{
|
||||
if (cpu_flag_memory)
|
||||
{
|
||||
|
@ -140,7 +141,7 @@ bool cpu_thread::check_state()
|
|||
|
||||
break;
|
||||
}
|
||||
else if (!cpu_sleep_called && test(state, cpu_flag::suspend))
|
||||
else if (!cpu_sleep_called && state & cpu_flag::suspend)
|
||||
{
|
||||
cpu_sleep();
|
||||
cpu_sleep_called = true;
|
||||
|
@ -152,12 +153,12 @@ bool cpu_thread::check_state()
|
|||
|
||||
const auto state_ = state.load();
|
||||
|
||||
if (test(state_, cpu_flag::ret + cpu_flag::stop))
|
||||
if (state_ & (cpu_flag::ret + cpu_flag::stop))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (test(state_, cpu_flag::dbg_step))
|
||||
if (state_ & cpu_flag::dbg_step)
|
||||
{
|
||||
state += cpu_flag::dbg_pause;
|
||||
state -= cpu_flag::dbg_step;
|
||||
|
@ -168,7 +169,7 @@ bool cpu_thread::check_state()
|
|||
|
||||
void cpu_thread::test_state()
|
||||
{
|
||||
if (UNLIKELY(test(state)))
|
||||
if (UNLIKELY(state))
|
||||
{
|
||||
if (check_state())
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue