1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-08 21:21:48 +00:00

Make Result produce the same code as Nintendo's

This commit is contained in:
TuxSH 2018-11-03 11:36:19 +01:00 committed by Michael Scire
parent 672204c993
commit be17f1f494

View file

@ -59,11 +59,18 @@ class Result final {
NotDebugged = 520, NotDebugged = 520,
}; };
constexpr Result() : module{(uint)Module::None}, description{(uint)Description::None} {} constexpr Result() : module{(uint)Module::None}, description{(uint)Description::None}, padding{0} {}
constexpr Result(Description description, Module module = Module::Kernel) : module{(uint)module}, description{(uint)description} {} constexpr Result(Description description, Module module = Module::Kernel) :
module{(uint)module}, description{(uint)description}, padding{0} {}
constexpr bool IsSuccess() const { return module == (uint)Module::None && description == (uint)Description::None; } constexpr bool IsSuccess() const
constexpr bool operator==(const Result &other) const { return module == other.module && description == other.description; } {
return module == (uint)Module::None && description == (uint)Description::None && padding == 0;
}
constexpr bool operator==(const Result &other) const
{
return module == other.module && description == other.description && padding == other.padding;
}
constexpr bool operator!=(const Result &other) const { return !(*this == other); } constexpr bool operator!=(const Result &other) const { return !(*this == other); }
constexpr Module GetModule() const { return (Module)module; } constexpr Module GetModule() const { return (Module)module; }
@ -74,6 +81,7 @@ class Result final {
private: private:
uint module : 9; uint module : 9;
uint description : 13; uint description : 13;
uint padding : 10;
}; };
} }