mirror of
https://github.com/azahar-emu/dynarmic
synced 2025-11-07 07:29:59 +01:00
common: Add atomic
Implement atomic or operation on u32
This commit is contained in:
parent
f6be6bc14b
commit
116297ccd5
20
src/dynarmic/common/atomic.h
Normal file
20
src/dynarmic/common/atomic.h
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/* This file is part of the dynarmic project.
|
||||||
|
* Copyright (c) 2022 MerryMage
|
||||||
|
* SPDX-License-Identifier: 0BSD
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "dynarmic/common/common_types.h"
|
||||||
|
|
||||||
|
namespace Dynarmic::Atomic {
|
||||||
|
|
||||||
|
inline void Or(volatile u32* ptr, u32 value) {
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
_InterlockedOr(reinterpret_cast<volatile long*>(ptr), value);
|
||||||
|
#else
|
||||||
|
__atomic_or_fetch(ptr, value, __ATOMIC_SEQ_CST);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Dynarmic::Atomic
|
||||||
Loading…
x
Reference in New Issue
Block a user