sys: Make sure constexpr variables don't get copied onto the stack

This commit is contained in:
WerWolv
2022-09-12 21:28:02 +02:00
parent 7e3601989a
commit aa658b7dbc
14 changed files with 29 additions and 29 deletions

View File

@@ -179,10 +179,10 @@ namespace hex {
return result;
}
static constexpr auto CTRL = Key(static_cast<Keys>(0x1000'0000));
static constexpr auto ALT = Key(static_cast<Keys>(0x2000'0000));
static constexpr auto SHIFT = Key(static_cast<Keys>(0x4000'0000));
static constexpr auto SUPER = Key(static_cast<Keys>(0x8000'0000));
constexpr static auto CTRL = Key(static_cast<Keys>(0x1000'0000));
constexpr static auto ALT = Key(static_cast<Keys>(0x2000'0000));
constexpr static auto SHIFT = Key(static_cast<Keys>(0x4000'0000));
constexpr static auto SUPER = Key(static_cast<Keys>(0x8000'0000));
class ShortcutManager {
public:

View File

@@ -31,7 +31,7 @@ namespace hex {
class Disassembler {
public:
static constexpr cs_arch toCapstoneArchitecture(Architecture architecture) {
constexpr static cs_arch toCapstoneArchitecture(Architecture architecture) {
return static_cast<cs_arch>(architecture);
}

View File

@@ -35,7 +35,7 @@ namespace hex {
Net();
~Net();
static constexpr u32 DefaultTimeout = 2'000;
constexpr static u32 DefaultTimeout = 2'000;
std::future<Response<std::string>> getString(const std::string &url, u32 timeout = DefaultTimeout);
std::future<Response<nlohmann::json>> getJson(const std::string &url, u32 timeout = DefaultTimeout);

View File

@@ -233,7 +233,7 @@ namespace hex {
}
std::string toEngineeringString(double value) {
constexpr std::array Suffixes = { "a", "f", "p", "n", "u", "m", "", "k", "M", "G", "T", "P", "E" };
constexpr static std::array Suffixes = { "a", "f", "p", "n", "u", "m", "", "k", "M", "G", "T", "P", "E" };
int8_t suffixIndex = 6;