mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 04:22:50 +02:00
Added result.h.
This commit is contained in:
parent
3b48bab62a
commit
6c05799e8c
@ -9,6 +9,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#include <switch/types.h>
|
||||
#include <switch/result.h>
|
||||
#include <switch/svc.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
20
nx/include/switch/result.h
Normal file
20
nx/include/switch/result.h
Normal file
@ -0,0 +1,20 @@
|
||||
/**
|
||||
* @file result.h
|
||||
* @brief Switch result code tools
|
||||
*/
|
||||
#pragma once
|
||||
#include "types.h"
|
||||
|
||||
/// Checks whether a result code indicates success.
|
||||
#define R_SUCCEEDED(res) ((res)==0)
|
||||
/// Checks whether a result code indicates failure.
|
||||
#define R_FAILED(res) ((res)!=0)
|
||||
/// Returns the module ID of a result code.
|
||||
#define R_MODULE(res) ((res)&0x1FF)
|
||||
/// Returns the description of a result code.
|
||||
#define R_DESCRIPTION(res) (((res)>>9)&0x1FFF)
|
||||
|
||||
/// Builds a result code from its constituent components.
|
||||
#define MAKERESULT(module,description) \
|
||||
((((module)&0x1FF)) | ((description)&0x1FFF)<<9)
|
||||
|
Loading…
Reference in New Issue
Block a user