mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-12-01 15:56:32 -05:00
hle: kernel: Drop R_UNLESS_NOLOG in favor of expanded if-statement.
This commit is contained in:
parent
546af64340
commit
ea4f62615e
3 changed files with 11 additions and 11 deletions
|
@ -104,14 +104,6 @@ __declspec(dllimport) void __stdcall DebugBreak(void);
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Evaluates a boolean expression, and returns a result unless that expression is true.
|
|
||||||
#define R_UNLESS_NOLOG(expr, res) \
|
|
||||||
{ \
|
|
||||||
if (!(expr)) { \
|
|
||||||
return res; \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define R_SUCCEEDED(res) (res.IsSuccess())
|
#define R_SUCCEEDED(res) (res.IsSuccess())
|
||||||
|
|
||||||
/// Evaluates an expression that returns a result, and returns the result if it would fail.
|
/// Evaluates an expression that returns a result, and returns the result if it would fail.
|
||||||
|
|
|
@ -120,7 +120,10 @@ ResultCode KAddressArbiter::SignalAndIncrementIfEqual(VAddr addr, s32 value, s32
|
||||||
s32 user_value{};
|
s32 user_value{};
|
||||||
R_UNLESS(UpdateIfEqual(system, std::addressof(user_value), addr, value, value + 1),
|
R_UNLESS(UpdateIfEqual(system, std::addressof(user_value), addr, value, value + 1),
|
||||||
Svc::ResultInvalidCurrentMemory);
|
Svc::ResultInvalidCurrentMemory);
|
||||||
R_UNLESS_NOLOG(user_value == value, Svc::ResultInvalidState);
|
|
||||||
|
if (user_value != value) {
|
||||||
|
return Svc::ResultInvalidState;
|
||||||
|
}
|
||||||
|
|
||||||
auto it = thread_tree.nfind_light({addr, -1});
|
auto it = thread_tree.nfind_light({addr, -1});
|
||||||
while ((it != thread_tree.end()) && (count <= 0 || num_waiters < count) &&
|
while ((it != thread_tree.end()) && (count <= 0 || num_waiters < count) &&
|
||||||
|
@ -211,7 +214,10 @@ ResultCode KAddressArbiter::SignalAndModifyByWaitingCountIfEqual(VAddr addr, s32
|
||||||
}
|
}
|
||||||
|
|
||||||
R_UNLESS(succeeded, Svc::ResultInvalidCurrentMemory);
|
R_UNLESS(succeeded, Svc::ResultInvalidCurrentMemory);
|
||||||
R_UNLESS_NOLOG(user_value == value, Svc::ResultInvalidState);
|
|
||||||
|
if (user_value != value) {
|
||||||
|
return Svc::ResultInvalidState;
|
||||||
|
}
|
||||||
|
|
||||||
while ((it != thread_tree.end()) && (count <= 0 || num_waiters < count) &&
|
while ((it != thread_tree.end()) && (count <= 0 || num_waiters < count) &&
|
||||||
(it->GetAddressArbiterKey() == addr)) {
|
(it->GetAddressArbiterKey() == addr)) {
|
||||||
|
|
|
@ -46,7 +46,9 @@ ResultCode KReadableEvent::Clear() {
|
||||||
ResultCode KReadableEvent::Reset() {
|
ResultCode KReadableEvent::Reset() {
|
||||||
KScopedSchedulerLock lk{kernel};
|
KScopedSchedulerLock lk{kernel};
|
||||||
|
|
||||||
R_UNLESS_NOLOG(is_signaled, Svc::ResultInvalidState);
|
if (!is_signaled) {
|
||||||
|
return Svc::ResultInvalidState;
|
||||||
|
}
|
||||||
|
|
||||||
is_signaled = false;
|
is_signaled = false;
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
|
|
Loading…
Reference in a new issue