mirror of
https://github.com/switchbrew/libnx.git
synced 2025-07-04 18:42:15 +02:00
Add R_TRY helper macro
This commit is contained in:
parent
d2bfc032f8
commit
c48d2c5e5d
@ -17,6 +17,15 @@
|
|||||||
/// Masks out unused bits in a result code, retrieving the actual value for use in comparisons.
|
/// Masks out unused bits in a result code, retrieving the actual value for use in comparisons.
|
||||||
#define R_VALUE(res) ((res)&0x3FFFFF)
|
#define R_VALUE(res) ((res)&0x3FFFFF)
|
||||||
|
|
||||||
|
/// Evaluates an expression that returns a result, and returns the result if it would fail.
|
||||||
|
#define R_TRY(res_expr) \
|
||||||
|
do { \
|
||||||
|
const Result _tmp_r_try_rc = res_expr; \
|
||||||
|
if (R_FAILED(_tmp_r_try_rc)) { \
|
||||||
|
return _tmp_r_try_rc; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
/// Builds a result code from its constituent components.
|
/// Builds a result code from its constituent components.
|
||||||
#define MAKERESULT(module,description) \
|
#define MAKERESULT(module,description) \
|
||||||
((((module)&0x1FF)) | ((description)&0x1FFF)<<9)
|
((((module)&0x1FF)) | ((description)&0x1FFF)<<9)
|
||||||
|
Loading…
Reference in New Issue
Block a user