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

@ -1014,13 +1014,13 @@ void lv2_obj::sleep_timeout(named_thread& thread, u64 timeout)
auto state = ppu->state.fetch_op([&](auto& val)
{
if (!test(val, cpu_flag::signal))
if (!(val & cpu_flag::signal))
{
val += cpu_flag::suspend;
}
});
if (test(state, cpu_flag::signal))
if (state & cpu_flag::signal)
{
LOG_TRACE(PPU, "sleep() failed (signaled)");
return;
@ -1156,7 +1156,7 @@ void lv2_obj::schedule_all()
{
const auto target = g_ppu[i];
if (test(target->state, cpu_flag::suspend))
if (target->state & cpu_flag::suspend)
{
LOG_TRACE(PPU, "schedule(): %s", target->id);
target->state ^= (cpu_flag::signal + cpu_flag::suspend);