diff --git a/lib/external/imgui/include/imgui_memory_editor.h b/lib/external/imgui/include/imgui_memory_editor.h index d2ab09951..09d682f69 100644 --- a/lib/external/imgui/include/imgui_memory_editor.h +++ b/lib/external/imgui/include/imgui_memory_editor.h @@ -320,8 +320,8 @@ struct MemoryEditor else if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_DownArrow)) && DataEditingAddr < mem_size - Cols) { data_editing_addr_next = DataEditingAddr + Cols; DataEditingTakeFocus = true; } else if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_LeftArrow)) && DataEditingAddr > 0) { data_editing_addr_next = DataEditingAddr - 1; DataEditingTakeFocus = true; } else if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_RightArrow)) && DataEditingAddr < mem_size - 1) { data_editing_addr_next = DataEditingAddr + 1; DataEditingTakeFocus = true; } - else if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_PageUp)) && DataEditingAddr > 0) { data_editing_addr_next = std::max(s64(0), s64(DataEditingAddr) - s64(visible_count)); DataEditingTakeFocus = true; } - else if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_PageDown)) && DataEditingAddr < mem_size - 1) { data_editing_addr_next = std::min(s64(mem_size - 1), s64(DataEditingAddr) + s64(visible_count)); DataEditingTakeFocus = true; } + else if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_PageUp)) && DataEditingAddr > 0) { data_editing_addr_next = std::max(0, DataEditingAddr - visible_count); DataEditingTakeFocus = true; } + else if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_PageDown)) && DataEditingAddr < mem_size - 1) { data_editing_addr_next = std::min(mem_size - 1, DataEditingAddr + visible_count); DataEditingTakeFocus = true; } else if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Home)) && DataEditingAddr > 0) { data_editing_addr_next = 0; DataEditingTakeFocus = true; } else if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_End)) && DataEditingAddr < mem_size - 1) { data_editing_addr_next = mem_size - 1; DataEditingTakeFocus = true; } } else if (DataPreviewAddr != -1) { @@ -329,8 +329,8 @@ struct MemoryEditor else if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_DownArrow)) && DataPreviewAddr < mem_size - Cols) { DataPreviewAddr = data_preview_addr_next = DataPreviewAddr + Cols; if (!ImGui::GetIO().KeyShift) DataPreviewAddrEnd = DataPreviewAddr; } else if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_LeftArrow)) && DataPreviewAddr > 0) { DataPreviewAddr = data_preview_addr_next = DataPreviewAddr - 1; if (!ImGui::GetIO().KeyShift) DataPreviewAddrEnd = DataPreviewAddr; } else if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_RightArrow)) && DataPreviewAddr < mem_size - 1) { DataPreviewAddr = data_preview_addr_next = DataPreviewAddr + 1; if (!ImGui::GetIO().KeyShift) DataPreviewAddrEnd = DataPreviewAddr; } - else if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_PageUp)) && DataPreviewAddr > 0) { DataPreviewAddr = data_preview_addr_next = std::max(s64(0), s64(DataPreviewAddr) - s64(visible_count)); if (!ImGui::GetIO().KeyShift) DataPreviewAddrEnd = DataPreviewAddr; } - else if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_PageDown)) && DataPreviewAddr < mem_size - 1) { DataPreviewAddr = data_preview_addr_next = std::min(s64(mem_size - 1), s64(DataPreviewAddr) + s64(visible_count)); if (!ImGui::GetIO().KeyShift) DataPreviewAddrEnd = DataPreviewAddr; } + else if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_PageUp)) && DataPreviewAddr > 0) { DataPreviewAddr = data_preview_addr_next = std::max(0, DataPreviewAddr - visible_count); if (!ImGui::GetIO().KeyShift) DataPreviewAddrEnd = DataPreviewAddr; } + else if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_PageDown)) && DataPreviewAddr < mem_size - 1) { DataPreviewAddr = data_preview_addr_next = std::min(mem_size - 1, DataPreviewAddr + visible_count); if (!ImGui::GetIO().KeyShift) DataPreviewAddrEnd = DataPreviewAddr; } else if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Home)) && DataPreviewAddr > 0) { DataPreviewAddr = data_preview_addr_next = 0; if (!ImGui::GetIO().KeyShift) DataPreviewAddrEnd = DataPreviewAddr; } else if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_End)) && DataPreviewAddr < mem_size - 1) { DataPreviewAddr = data_preview_addr_next = mem_size - 1; if (!ImGui::GetIO().KeyShift) DataPreviewAddrEnd = DataPreviewAddr; } } diff --git a/lib/libimhex/include/hex.hpp b/lib/libimhex/include/hex.hpp index ff92b6f70..979bf9b29 100644 --- a/lib/libimhex/include/hex.hpp +++ b/lib/libimhex/include/hex.hpp @@ -12,11 +12,11 @@ using u32 = std::uint32_t; using u64 = std::uint64_t; using u128 = __uint128_t; -using s8 = std::int8_t; -using s16 = std::int16_t; -using s32 = std::int32_t; -using s64 = std::int64_t; -using s128 = __int128_t; +using i8 = std::int8_t; +using i16 = std::int16_t; +using i32 = std::int32_t; +using i64 = std::int64_t; +using i128 = __int128_t; namespace hex { diff --git a/lib/libimhex/include/hex/api/content_registry.hpp b/lib/libimhex/include/hex/api/content_registry.hpp index 16f8bd613..f9f8c2efa 100644 --- a/lib/libimhex/include/hex/api/content_registry.hpp +++ b/lib/libimhex/include/hex/api/content_registry.hpp @@ -43,14 +43,14 @@ namespace hex { void load(); void store(); - void add(const std::string &unlocalizedCategory, const std::string &unlocalizedName, s64 defaultValue, const Callback &callback); + void add(const std::string &unlocalizedCategory, const std::string &unlocalizedName, i64 defaultValue, const Callback &callback); void add(const std::string &unlocalizedCategory, const std::string &unlocalizedName, const std::string &defaultValue, const Callback &callback); - void write(const std::string &unlocalizedCategory, const std::string &unlocalizedName, s64 value); + void write(const std::string &unlocalizedCategory, const std::string &unlocalizedName, i64 value); void write(const std::string &unlocalizedCategory, const std::string &unlocalizedName, const std::string &value); void write(const std::string &unlocalizedCategory, const std::string &unlocalizedName, const std::vector& value); - s64 read(const std::string &unlocalizedCategory, const std::string &unlocalizedName, s64 defaultValue); + i64 read(const std::string &unlocalizedCategory, const std::string &unlocalizedName, i64 defaultValue); std::string read(const std::string &unlocalizedCategory, const std::string &unlocalizedName, const std::string &defaultValue); std::vector read(const std::string &unlocalizedCategory, const std::string &unlocalizedName, const std::vector& defaultValue = { }); diff --git a/lib/libimhex/include/hex/helpers/concepts.hpp b/lib/libimhex/include/hex/helpers/concepts.hpp index 5cfa58049..29a07f10f 100644 --- a/lib/libimhex/include/hex/helpers/concepts.hpp +++ b/lib/libimhex/include/hex/helpers/concepts.hpp @@ -13,31 +13,31 @@ namespace hex { struct is_integral_helper : public std::true_type { }; template<> - struct is_integral_helper : public std::true_type { }; + struct is_integral_helper : public std::true_type { }; template<> struct is_integral_helper : public std::true_type { }; template<> - struct is_integral_helper : public std::true_type { }; + struct is_integral_helper : public std::true_type { }; template<> struct is_integral_helper : public std::true_type { }; template<> - struct is_integral_helper : public std::true_type { }; + struct is_integral_helper : public std::true_type { }; template<> struct is_integral_helper : public std::true_type { }; template<> - struct is_integral_helper : public std::true_type { }; + struct is_integral_helper : public std::true_type { }; template<> struct is_integral_helper : public std::true_type { }; template<> - struct is_integral_helper : public std::true_type { }; + struct is_integral_helper : public std::true_type { }; template<> struct is_integral_helper : public std::true_type { }; @@ -65,19 +65,19 @@ namespace hex { struct is_signed_helper : public std::false_type { }; template<> - struct is_signed_helper : public std::true_type { }; + struct is_signed_helper : public std::true_type { }; template<> - struct is_signed_helper : public std::true_type { }; + struct is_signed_helper : public std::true_type { }; template<> - struct is_signed_helper : public std::true_type { }; + struct is_signed_helper : public std::true_type { }; template<> - struct is_signed_helper : public std::true_type { }; + struct is_signed_helper : public std::true_type { }; template<> - struct is_signed_helper : public std::true_type { }; + struct is_signed_helper : public std::true_type { }; template<> struct is_signed_helper : public std::true_type { }; diff --git a/lib/libimhex/include/hex/helpers/disassembler.hpp b/lib/libimhex/include/hex/helpers/disassembler.hpp index d6465ce7f..36f73e482 100644 --- a/lib/libimhex/include/hex/helpers/disassembler.hpp +++ b/lib/libimhex/include/hex/helpers/disassembler.hpp @@ -9,7 +9,7 @@ namespace hex { - enum class Architecture : s32 { + enum class Architecture : i32 { ARM, ARM64, MIPS, @@ -43,14 +43,14 @@ namespace hex { constexpr static const char * const ArchitectureNames[] = { "ARM32", "ARM64", "MIPS", "x86", "PowerPC", "Sparc", "SystemZ", "XCore", "68K", "TMS320C64x", "680X", "Ethereum", "MOS65XX", "WebAssembly", "Berkeley Packet Filter", "RISC-V" }; - static inline s32 getArchitectureSupportedCount() { - static s32 supportedCount = -1; + static inline i32 getArchitectureSupportedCount() { + static i32 supportedCount = -1; if (supportedCount != -1) { return supportedCount; } - for (supportedCount = static_cast(Architecture::MIN); supportedCount < static_cast(Architecture::MAX); supportedCount++) { + for (supportedCount = static_cast(Architecture::MIN); supportedCount < static_cast(Architecture::MAX); supportedCount++) { if (!cs_support(supportedCount)) { break; } diff --git a/lib/libimhex/include/hex/helpers/net.hpp b/lib/libimhex/include/hex/helpers/net.hpp index 2b9f56632..63d3a0c64 100644 --- a/lib/libimhex/include/hex/helpers/net.hpp +++ b/lib/libimhex/include/hex/helpers/net.hpp @@ -21,13 +21,13 @@ namespace hex { template struct Response { - s32 code; + i32 code; T body; }; template<> struct Response { - s32 code; + i32 code; }; class Net { @@ -51,7 +51,7 @@ namespace hex { private: void setCommonSettings(std::string &response, const std::string &url, u32 timeout = 2000, const std::map &extraHeaders = { }, const std::string &body = { }); - std::optional execute(); + std::optional execute(); friend int progressCallback(void *contents, curl_off_t dlTotal, curl_off_t dlNow, curl_off_t ulTotal, curl_off_t ulNow); private: diff --git a/lib/libimhex/include/hex/helpers/utils.hpp b/lib/libimhex/include/hex/helpers/utils.hpp index 72dffe0f0..d54c25bec 100644 --- a/lib/libimhex/include/hex/helpers/utils.hpp +++ b/lib/libimhex/include/hex/helpers/utils.hpp @@ -33,7 +33,7 @@ namespace hex { ImVec2 scaled(const ImVec2 &vector); std::string to_string(u128 value); - std::string to_string(s128 value); + std::string to_string(i128 value); std::string toByteString(u64 bytes); std::string makePrintable(u8 c); @@ -66,8 +66,8 @@ namespace hex { return (value & mask) >> to; } - constexpr inline s128 signExtend(size_t numBits, s128 value) { - s128 mask = 1U << (numBits - 1); + constexpr inline i128 signExtend(size_t numBits, i128 value) { + i128 mask = 1U << (numBits - 1); return (value ^ mask) - mask; } @@ -193,7 +193,7 @@ namespace hex { if (number == 0) return "0"; std::string result; - for (s16 bit = hex::bit_width(number) - 1; bit >= 0; bit--) + for (i16 bit = hex::bit_width(number) - 1; bit >= 0; bit--) result += (number & (0b1 << bit)) == 0 ? '0' : '1'; return result; diff --git a/lib/libimhex/include/hex/pattern_language/ast_node.hpp b/lib/libimhex/include/hex/pattern_language/ast_node.hpp index 0945ed8c9..c293415ad 100644 --- a/lib/libimhex/include/hex/pattern_language/ast_node.hpp +++ b/lib/libimhex/include/hex/pattern_language/ast_node.hpp @@ -189,13 +189,13 @@ namespace hex::pl { return std::visit(overloaded { // TODO: :notlikethis: [this](u128 left, PatternData * const &right) -> ASTNode* { LogConsole::abortEvaluation("invalid operand used in mathematical expression", this); }, - [this](s128 left, PatternData * const &right) -> ASTNode* { LogConsole::abortEvaluation("invalid operand used in mathematical expression", this); }, + [this](i128 left, PatternData * const &right) -> ASTNode* { LogConsole::abortEvaluation("invalid operand used in mathematical expression", this); }, [this](double left, PatternData * const &right) -> ASTNode* { LogConsole::abortEvaluation("invalid operand used in mathematical expression", this); }, [this](char left, PatternData * const &right) -> ASTNode* { LogConsole::abortEvaluation("invalid operand used in mathematical expression", this); }, [this](bool left, PatternData * const &right) -> ASTNode* { LogConsole::abortEvaluation("invalid operand used in mathematical expression", this); }, [this](std::string left, PatternData * const &right) -> ASTNode* { LogConsole::abortEvaluation("invalid operand used in mathematical expression", this); }, [this](PatternData * const &left, u128 right) -> ASTNode* { LogConsole::abortEvaluation("invalid operand used in mathematical expression", this); }, - [this](PatternData * const &left, s128 right) -> ASTNode* { LogConsole::abortEvaluation("invalid operand used in mathematical expression", this); }, + [this](PatternData * const &left, i128 right) -> ASTNode* { LogConsole::abortEvaluation("invalid operand used in mathematical expression", this); }, [this](PatternData * const &left, double right) -> ASTNode* { LogConsole::abortEvaluation("invalid operand used in mathematical expression", this); }, [this](PatternData * const &left, char right) -> ASTNode* { LogConsole::abortEvaluation("invalid operand used in mathematical expression", this); }, [this](PatternData * const &left, bool right) -> ASTNode* { LogConsole::abortEvaluation("invalid operand used in mathematical expression", this); }, @@ -512,15 +512,15 @@ namespace hex::pl { case Token::ValueType::Unsigned128Bit: return new ASTNodeLiteral(u128(endianAdjustedValue)); case Token::ValueType::Signed8Bit: - return new ASTNodeLiteral(s128(s8(endianAdjustedValue))); + return new ASTNodeLiteral(i128(i8(endianAdjustedValue))); case Token::ValueType::Signed16Bit: - return new ASTNodeLiteral(s128(s16(endianAdjustedValue))); + return new ASTNodeLiteral(i128(i16(endianAdjustedValue))); case Token::ValueType::Signed32Bit: - return new ASTNodeLiteral(s128(s32(endianAdjustedValue))); + return new ASTNodeLiteral(i128(i32(endianAdjustedValue))); case Token::ValueType::Signed64Bit: - return new ASTNodeLiteral(s128(s64(endianAdjustedValue))); + return new ASTNodeLiteral(i128(i64(endianAdjustedValue))); case Token::ValueType::Signed128Bit: - return new ASTNodeLiteral(s128(endianAdjustedValue)); + return new ASTNodeLiteral(i128(endianAdjustedValue)); case Token::ValueType::Float: return new ASTNodeLiteral(double(float(endianAdjustedValue))); case Token::ValueType::Double: @@ -601,7 +601,7 @@ namespace hex::pl { auto variables = *evaluator->getScope(0).scope; u32 startVariableCount = variables.size(); ON_SCOPE_EXIT { - s64 stackSize = evaluator->getStack().size(); + i64 stackSize = evaluator->getStack().size(); for (u32 i = startVariableCount; i < variables.size(); i++) { stackSize--; delete variables[i]; @@ -1540,7 +1540,7 @@ namespace hex::pl { readVariable(evaluator, value, pattern); literal = value; } else if (dynamic_cast(pattern)) { - s128 value = 0; + i128 value = 0; readVariable(evaluator, value, pattern); value = hex::signExtend(pattern->getSize() * 8, value); literal = value; @@ -1613,7 +1613,7 @@ namespace hex::pl { [[nodiscard]] std::vector createPatterns(Evaluator *evaluator) const override { std::vector searchScope; PatternData *currPattern = nullptr; - s32 scopeIndex = 0; + i32 scopeIndex = 0; if (!evaluator->isGlobalScope()){ auto globalScope = evaluator->getGlobalScope().scope; @@ -1873,7 +1873,7 @@ namespace hex::pl { auto variables = *evaluator->getScope(0).scope; u32 startVariableCount = variables.size(); ON_SCOPE_EXIT { - s64 stackSize = evaluator->getStack().size(); + i64 stackSize = evaluator->getStack().size(); for (u32 i = startVariableCount; i < variables.size(); i++) { stackSize--; delete variables[i]; @@ -2325,7 +2325,7 @@ namespace hex::pl { } if (this->m_newScope) { - s64 stackSize = evaluator->getStack().size(); + i64 stackSize = evaluator->getStack().size(); for (u32 i = startVariableCount; i < variables.size(); i++) { stackSize--; delete variables[i]; diff --git a/lib/libimhex/include/hex/pattern_language/evaluator.hpp b/lib/libimhex/include/hex/pattern_language/evaluator.hpp index 43f713ae2..e4a9b1779 100644 --- a/lib/libimhex/include/hex/pattern_language/evaluator.hpp +++ b/lib/libimhex/include/hex/pattern_language/evaluator.hpp @@ -59,7 +59,7 @@ namespace hex::pl { this->m_scopes.pop_back(); } - const Scope& getScope(s32 index) { + const Scope& getScope(i32 index) { return this->m_scopes[this->m_scopes.size() - 1 + index]; } diff --git a/lib/libimhex/include/hex/pattern_language/parser.hpp b/lib/libimhex/include/hex/pattern_language/parser.hpp index 43eb615b3..c4a0ff7ef 100644 --- a/lib/libimhex/include/hex/pattern_language/parser.hpp +++ b/lib/libimhex/include/hex/pattern_language/parser.hpp @@ -33,7 +33,7 @@ namespace hex::pl { std::vector m_matchedOptionals; std::vector> m_currNamespace; - u32 getLineNumber(s32 index) const { + u32 getLineNumber(i32 index) const { return this->m_curr[index].lineNumber; } @@ -43,7 +43,7 @@ namespace hex::pl { } template - const T& getValue(s32 index) const { + const T& getValue(i32 index) const { auto value = std::get_if(&this->m_curr[index].value); if (value == nullptr) @@ -52,7 +52,7 @@ namespace hex::pl { return *value; } - Token::Type getType(s32 index) const { + Token::Type getType(i32 index) const { return this->m_curr[index].type; } @@ -141,7 +141,7 @@ namespace hex::pl { return program; } - [[noreturn]] void throwParseError(const std::string &error, s32 token = -1) const { + [[noreturn]] void throwParseError(const std::string &error, i32 token = -1) const { throw ParseError(this->m_curr[token].lineNumber, "Parser: " + error); } @@ -245,7 +245,7 @@ namespace hex::pl { return true; } - bool peek(Token::Type type, auto value, s32 index = 0) { + bool peek(Token::Type type, auto value, i32 index = 0) { return this->m_curr[index].type == type && this->m_curr[index] == value; } diff --git a/lib/libimhex/include/hex/pattern_language/pattern_data.hpp b/lib/libimhex/include/hex/pattern_language/pattern_data.hpp index 3cf5970ac..11f095a6c 100644 --- a/lib/libimhex/include/hex/pattern_language/pattern_data.hpp +++ b/lib/libimhex/include/hex/pattern_language/pattern_data.hpp @@ -500,7 +500,7 @@ namespace hex::pl { } void createEntry(prv::Provider* &provider) override { - s128 data = 0; + i128 data = 0; provider->read(this->getOffset(), &data, this->getSize()); data = hex::changeEndianess(data, this->getSize(), this->getEndian()); diff --git a/lib/libimhex/include/hex/pattern_language/token.hpp b/lib/libimhex/include/hex/pattern_language/token.hpp index 98a4d8355..c632e8f05 100644 --- a/lib/libimhex/include/hex/pattern_language/token.hpp +++ b/lib/libimhex/include/hex/pattern_language/token.hpp @@ -133,7 +133,7 @@ namespace hex::pl { std::string m_identifier; }; - using Literal = std::variant; + using Literal = std::variant; using ValueTypes = std::variant; Token(Type type, auto value, u32 lineNumber) : type(type), value(value), lineNumber(lineNumber) { @@ -165,11 +165,11 @@ namespace hex::pl { literal); } - static s128 literalToSigned(const pl::Token::Literal &literal) { + static i128 literalToSigned(const pl::Token::Literal &literal) { return std::visit(overloaded { - [](std::string) -> s128 { throw std::string("expected integral type, got string"); }, - [](PatternData*) -> s128 { throw std::string("expected integral type, got custom type"); }, - [](auto &&value) -> s128 { return value; } + [](std::string) -> i128 { throw std::string("expected integral type, got string"); }, + [](PatternData*) -> i128 { throw std::string("expected integral type, got custom type"); }, + [](auto &&value) -> i128 { return value; } }, literal); } @@ -199,7 +199,7 @@ namespace hex::pl { return std::visit(overloaded { [](std::string value) -> std::string { return value; }, [](u128 value) -> std::string { return std::to_string(u64(value)); }, - [](s128 value) -> std::string { return std::to_string(s64(value)); }, + [](i128 value) -> std::string { return std::to_string(i64(value)); }, [](bool value) -> std::string { return value ? "true" : "false"; }, [](char value) -> std::string { return std::string() + value; }, [](PatternData*) -> std::string { throw std::string("expected integral type, got custom type"); }, diff --git a/lib/libimhex/source/api/content_registry.cpp b/lib/libimhex/source/api/content_registry.cpp index b91da1ee0..667aa7cb4 100644 --- a/lib/libimhex/source/api/content_registry.cpp +++ b/lib/libimhex/source/api/content_registry.cpp @@ -40,7 +40,7 @@ namespace hex { } } - void ContentRegistry::Settings::add(const std::string &unlocalizedCategory, const std::string &unlocalizedName, s64 defaultValue, const ContentRegistry::Settings::Callback &callback) { + void ContentRegistry::Settings::add(const std::string &unlocalizedCategory, const std::string &unlocalizedName, i64 defaultValue, const ContentRegistry::Settings::Callback &callback) { log::info("Registered new integer setting: [{}]: {}", unlocalizedCategory, unlocalizedName); ContentRegistry::Settings::getEntries()[unlocalizedCategory.c_str()].emplace_back(Entry{ unlocalizedName.c_str(), callback }); @@ -66,7 +66,7 @@ namespace hex { json[unlocalizedCategory][unlocalizedName] = std::string(defaultValue); } - void ContentRegistry::Settings::write(const std::string &unlocalizedCategory, const std::string &unlocalizedName, s64 value) { + void ContentRegistry::Settings::write(const std::string &unlocalizedCategory, const std::string &unlocalizedName, i64 value) { auto &json = getSettingsData(); if (!json.contains(unlocalizedCategory)) @@ -94,7 +94,7 @@ namespace hex { } - s64 ContentRegistry::Settings::read(const std::string &unlocalizedCategory, const std::string &unlocalizedName, s64 defaultValue) { + i64 ContentRegistry::Settings::read(const std::string &unlocalizedCategory, const std::string &unlocalizedName, i64 defaultValue) { auto &json = getSettingsData(); if (!json.contains(unlocalizedCategory)) @@ -105,7 +105,7 @@ namespace hex { if (!json[unlocalizedCategory][unlocalizedName].is_number()) json[unlocalizedCategory][unlocalizedName] = defaultValue; - return json[unlocalizedCategory][unlocalizedName].get(); + return json[unlocalizedCategory][unlocalizedName].get(); } std::string ContentRegistry::Settings::read(const std::string &unlocalizedCategory, const std::string &unlocalizedName, const std::string &defaultValue) { diff --git a/lib/libimhex/source/helpers/net.cpp b/lib/libimhex/source/helpers/net.cpp index c1b5dc567..4c58e8195 100644 --- a/lib/libimhex/source/helpers/net.cpp +++ b/lib/libimhex/source/helpers/net.cpp @@ -115,12 +115,12 @@ namespace hex { curl_easy_setopt(this->m_ctx, CURLOPT_NOPROGRESS, 0L); } - std::optional Net::execute() { + std::optional Net::execute() { CURLcode result = curl_easy_perform(this->m_ctx); if (result != CURLE_OK) log::error("Net request failed with error {}!", curl_easy_strerror(result)); - s32 responseCode = 0; + i32 responseCode = 0; curl_easy_getinfo(this->m_ctx, CURLINFO_RESPONSE_CODE, &responseCode); curl_slist_free_all(this->m_headers); diff --git a/lib/libimhex/source/helpers/utils.cpp b/lib/libimhex/source/helpers/utils.cpp index e028837a1..f87edaaa8 100644 --- a/lib/libimhex/source/helpers/utils.cpp +++ b/lib/libimhex/source/helpers/utils.cpp @@ -44,7 +44,7 @@ namespace hex { return std::string(data + index + 1); } - std::string to_string(s128 value) { + std::string to_string(i128 value) { char data[45] = { 0 }; u128 unsignedValue = value < 0 ? -value : value; diff --git a/lib/libimhex/source/pattern_language/evaluator.cpp b/lib/libimhex/source/pattern_language/evaluator.cpp index 770838d94..54b54d567 100644 --- a/lib/libimhex/source/pattern_language/evaluator.cpp +++ b/lib/libimhex/source/pattern_language/evaluator.cpp @@ -22,8 +22,8 @@ namespace hex::pl { if (std::get_if(&value.value()) != nullptr) pattern = new PatternDataUnsigned(0, sizeof(u128), this); - else if (std::get_if(&value.value()) != nullptr) - pattern = new PatternDataSigned(0, sizeof(s128), this); + else if (std::get_if(&value.value()) != nullptr) + pattern = new PatternDataSigned(0, sizeof(i128), this); else if (std::get_if(&value.value()) != nullptr) pattern = new PatternDataFloat(0, sizeof(double), this); else if (std::get_if(&value.value()) != nullptr) @@ -83,7 +83,7 @@ namespace hex::pl { if (dynamic_cast(pattern)) return u128(value) & bitmask(pattern->getSize() * 8); else if (dynamic_cast(pattern)) - return s128(value) & bitmask(pattern->getSize() * 8); + return i128(value) & bitmask(pattern->getSize() * 8); else if (dynamic_cast(pattern)) return pattern->getSize() == sizeof(float) ? double(float(value)) : value; else @@ -105,7 +105,7 @@ namespace hex::pl { if (dynamic_cast(pattern) || dynamic_cast(pattern)) return u128(value) & bitmask(pattern->getSize() * 8); else if (dynamic_cast(pattern)) - return s128(value) & bitmask(pattern->getSize() * 8); + return i128(value) & bitmask(pattern->getSize() * 8); else if (dynamic_cast(pattern)) return char(value); else if (dynamic_cast(pattern)) diff --git a/lib/libimhex/source/pattern_language/lexer.cpp b/lib/libimhex/source/pattern_language/lexer.cpp index 45f16f872..d4bf14306 100644 --- a/lib/libimhex/source/pattern_language/lexer.cpp +++ b/lib/libimhex/source/pattern_language/lexer.cpp @@ -108,7 +108,7 @@ namespace hex::pl { switch (type) { case Token::ValueType::Unsigned128Bit: return { u128(integer) }; - case Token::ValueType::Signed128Bit: return { s128(integer) }; + case Token::ValueType::Signed128Bit: return { i128(integer) }; default: return { }; } } else if (Token::isFloatingPoint(type)) { diff --git a/lib/libimhex/source/pattern_language/preprocessor.cpp b/lib/libimhex/source/pattern_language/preprocessor.cpp index ec27e3480..e7881ae09 100644 --- a/lib/libimhex/source/pattern_language/preprocessor.cpp +++ b/lib/libimhex/source/pattern_language/preprocessor.cpp @@ -195,7 +195,7 @@ namespace hex::pl { }); for (const auto &[define, value, defineLine] : sortedDefines) { - s32 index = 0; + i32 index = 0; while((index = output.find(define, index)) != std::string::npos) { output.replace(index, define.length(), value); index += value.length(); diff --git a/lib/libimhex/source/providers/provider.cpp b/lib/libimhex/source/providers/provider.cpp index ebd01a0b0..3c7df8772 100644 --- a/lib/libimhex/source/providers/provider.cpp +++ b/lib/libimhex/source/providers/provider.cpp @@ -57,10 +57,10 @@ namespace hex::prv { auto overlayOffset = overlay->getAddress(); auto overlaySize = overlay->getSize(); - s128 overlapMin = std::max(offset, overlayOffset); - s128 overlapMax = std::min(offset + size, overlayOffset + overlaySize); + i128 overlapMin = std::max(offset, overlayOffset); + i128 overlapMax = std::min(offset + size, overlayOffset + overlaySize); if (overlapMax > overlapMin) - std::memcpy(static_cast(buffer) + std::max(0, overlapMin - offset), overlay->getData().data() + std::max(0, overlapMin - overlayOffset), overlapMax - overlapMin); + std::memcpy(static_cast(buffer) + std::max(0, overlapMin - offset), overlay->getData().data() + std::max(0, overlapMin - overlayOffset), overlapMax - overlapMin); } } diff --git a/main/source/window/window.cpp b/main/source/window/window.cpp index 0f926c8b7..f0a906e84 100644 --- a/main/source/window/window.cpp +++ b/main/source/window/window.cpp @@ -381,7 +381,7 @@ namespace hex { { ImGui::SetCursorPos(sidebarPos); - static s32 openWindow = -1; + static i32 openWindow = -1; u32 index = 0; ImGui::PushID("SideBarWindows"); for (const auto &[icon, callback] : ContentRegistry::Interface::getSidebarItems()) { diff --git a/plugins/builtin/include/content/views/view_hexeditor.hpp b/plugins/builtin/include/content/views/view_hexeditor.hpp index 4ac31d3ab..c025b88b4 100644 --- a/plugins/builtin/include/content/views/view_hexeditor.hpp +++ b/plugins/builtin/include/content/views/view_hexeditor.hpp @@ -35,11 +35,11 @@ namespace hex::plugin::builtin { SearchFunction m_searchFunction = nullptr; std::vector> *m_lastSearchBuffer; - s64 m_lastSearchIndex = 0; + i64 m_lastSearchIndex = 0; std::vector> m_lastStringSearch; std::vector> m_lastHexSearch; - s64 m_gotoAddress = 0; + i64 m_gotoAddress = 0; char m_baseAddressBuffer[0x20] = { 0 }; u64 m_resizeSize = 0; diff --git a/plugins/builtin/include/content/views/view_yara.hpp b/plugins/builtin/include/content/views/view_yara.hpp index eabc0664c..441301ff4 100644 --- a/plugins/builtin/include/content/views/view_yara.hpp +++ b/plugins/builtin/include/content/views/view_yara.hpp @@ -19,8 +19,8 @@ namespace hex::plugin::builtin { struct YaraMatch { std::string identifier; std::string variable; - s64 address; - s32 size; + i64 address; + i32 size; bool wholeDataMatch; }; diff --git a/plugins/builtin/source/content/data_inspector.cpp b/plugins/builtin/source/content/data_inspector.cpp index 1f6773012..8fde204f5 100644 --- a/plugins/builtin/source/content/data_inspector.cpp +++ b/plugins/builtin/source/content/data_inspector.cpp @@ -45,10 +45,10 @@ namespace hex::plugin::builtin { return [value] { ImGui::TextUnformatted(value.c_str()); return value; }; }); - ContentRegistry::DataInspector::add("hex.builtin.inspector.s8", sizeof(s8), [](auto buffer, auto endian, auto style) { + ContentRegistry::DataInspector::add("hex.builtin.inspector.i8", sizeof(i8), [](auto buffer, auto endian, auto style) { auto format = (style == Style::Decimal) ? "{0}{1:d}" : ((style == Style::Hexadecimal) ? "{0}0x{1:02X}" : "{0}0o{1:03o}"); - auto number = hex::changeEndianess(*reinterpret_cast(buffer.data()), endian); + auto number = hex::changeEndianess(*reinterpret_cast(buffer.data()), endian); bool negative = number < 0; auto value = hex::format(format, negative ? "-" : "", std::abs(number)); @@ -63,10 +63,10 @@ namespace hex::plugin::builtin { return [value] { ImGui::TextUnformatted(value.c_str()); return value; }; }); - ContentRegistry::DataInspector::add("hex.builtin.inspector.s16", sizeof(s16), [](auto buffer, auto endian, auto style) { + ContentRegistry::DataInspector::add("hex.builtin.inspector.i16", sizeof(i16), [](auto buffer, auto endian, auto style) { auto format = (style == Style::Decimal) ? "{0}{1:d}" : ((style == Style::Hexadecimal) ? "{0}0x{1:04X}" : "{0}0o{1:06o}"); - auto number = hex::changeEndianess(*reinterpret_cast(buffer.data()), endian); + auto number = hex::changeEndianess(*reinterpret_cast(buffer.data()), endian); bool negative = number < 0; auto value = hex::format(format, negative ? "-" : "", std::abs(number)); @@ -81,10 +81,10 @@ namespace hex::plugin::builtin { return [value] { ImGui::TextUnformatted(value.c_str()); return value; }; }); - ContentRegistry::DataInspector::add("hex.builtin.inspector.s32", sizeof(s32), [](auto buffer, auto endian, auto style) { + ContentRegistry::DataInspector::add("hex.builtin.inspector.i32", sizeof(i32), [](auto buffer, auto endian, auto style) { auto format = (style == Style::Decimal) ? "{0}{1:d}" : ((style == Style::Hexadecimal) ? "{0}0x{1:08X}" : "{0}0o{1:011o}"); - auto number = hex::changeEndianess(*reinterpret_cast(buffer.data()), endian); + auto number = hex::changeEndianess(*reinterpret_cast(buffer.data()), endian); bool negative = number < 0; auto value = hex::format(format, negative ? "-" : "", std::abs(number)); @@ -99,10 +99,10 @@ namespace hex::plugin::builtin { return [value] { ImGui::TextUnformatted(value.c_str()); return value; }; }); - ContentRegistry::DataInspector::add("hex.builtin.inspector.s64", sizeof(s64), [](auto buffer, auto endian, auto style) { + ContentRegistry::DataInspector::add("hex.builtin.inspector.i64", sizeof(i64), [](auto buffer, auto endian, auto style) { auto format = (style == Style::Decimal) ? "{0}{1:d}" : ((style == Style::Hexadecimal) ? "{0}0x{1:016X}" : "{0}0o{1:022o}"); - auto number = hex::changeEndianess(*reinterpret_cast(buffer.data()), endian); + auto number = hex::changeEndianess(*reinterpret_cast(buffer.data()), endian); bool negative = number < 0; auto value = hex::format(format, negative ? "-" : "", std::abs(number)); diff --git a/plugins/builtin/source/content/pl_builtin_functions.cpp b/plugins/builtin/source/content/pl_builtin_functions.cpp index add70e8c2..57226813e 100644 --- a/plugins/builtin/source/content/pl_builtin_functions.cpp +++ b/plugins/builtin/source/content/pl_builtin_functions.cpp @@ -173,7 +173,7 @@ namespace hex::plugin::builtin { if (size > 16) LogConsole::abortEvaluation("read size out of range"); - s128 value; + i128 value; ctx->getProvider()->read(address, &value, size); return hex::signExtend(size * 8, value); }); @@ -238,7 +238,7 @@ namespace hex::plugin::builtin { auto string = Token::literalToString(params[0], false); auto base = Token::literalToUnsigned(params[1]); - return s128(std::strtoll(string.c_str(), nullptr, base)); + return i128(std::strtoll(string.c_str(), nullptr, base)); }); /* parse_float(string) */ diff --git a/plugins/builtin/source/content/tools_entries.cpp b/plugins/builtin/source/content/tools_entries.cpp index 882b835dc..a6824cc59 100644 --- a/plugins/builtin/source/content/tools_entries.cpp +++ b/plugins/builtin/source/content/tools_entries.cpp @@ -543,7 +543,7 @@ namespace hex::plugin::builtin { clipper.Begin(links.size()); while (clipper.Step()) { - for (s32 i = clipper.DisplayEnd - 1; i >= clipper.DisplayStart; i--) { + for (i32 i = clipper.DisplayEnd - 1; i >= clipper.DisplayStart; i--) { auto &[fileName, link, size] = links[i]; ImGui::TableNextRow(); @@ -888,7 +888,7 @@ namespace hex::plugin::builtin { static bool combining = false; static std::vector files; static auto outputPath = []{ std::string s; s.reserve(0x1000); return s; }(); - static s32 selectedIndex; + static i32 selectedIndex; if (ImGui::BeginTable("files_table", 2, ImGuiTableFlags_SizingStretchProp)) { ImGui::TableSetupColumn("file list", ImGuiTableColumnFlags_NoHeaderLabel, 10); @@ -898,7 +898,7 @@ namespace hex::plugin::builtin { if (ImGui::BeginListBox("##files", { -FLT_MIN, 10 * ImGui::GetTextLineHeightWithSpacing() })) { - s32 index = 0; + i32 index = 0; for (auto &file : files) { if (ImGui::Selectable(fs::path(file).filename().string().c_str(), index == selectedIndex)) selectedIndex = index; diff --git a/plugins/builtin/source/content/views/view_diff.cpp b/plugins/builtin/source/content/views/view_diff.cpp index aefd87958..c636b4b73 100644 --- a/plugins/builtin/source/content/views/view_diff.cpp +++ b/plugins/builtin/source/content/views/view_diff.cpp @@ -68,7 +68,7 @@ namespace hex::plugin::builtin { enum class DiffResult { Same, Changed, Added, Removed }; struct LineInfo { std::vector bytes; - s64 validBytes = 0; + i64 validBytes = 0; }; static DiffResult diffBytes(u8 index, const LineInfo &a, const LineInfo &b) { @@ -97,7 +97,7 @@ namespace hex::plugin::builtin { // Read one line of each provider lineInfo[i].bytes.resize(this->m_columnCount); provider->read(row * this->m_columnCount, lineInfo[i].bytes.data(), lineInfo[i].bytes.size()); - lineInfo[i].validBytes = std::min(this->m_columnCount, provider->getSize() - row * this->m_columnCount); + lineInfo[i].validBytes = std::min(this->m_columnCount, provider->getSize() - row * this->m_columnCount); // Calculate address width u8 addressDigits = 0; @@ -122,12 +122,12 @@ namespace hex::plugin::builtin { const ImColor colorDisabled = this->m_greyedOutZeros ? ImGui::GetColorU32(ImGuiCol_TextDisabled) : static_cast(colorText); - for (s8 curr = 0; curr < 2; curr++) { + for (i8 curr = 0; curr < 2; curr++) { auto other = !curr; std::optional lastHighlightEnd; - for (s64 col = 0; col < lineInfo[curr].validBytes; col++) { + for (i64 col = 0; col < lineInfo[curr].validBytes; col++) { auto pos = ImGui::GetCursorScreenPos(); // Diff bytes diff --git a/plugins/builtin/source/content/views/view_hexeditor.cpp b/plugins/builtin/source/content/views/view_hexeditor.cpp index ba45e6998..c0a2546c4 100644 --- a/plugins/builtin/source/content/views/view_hexeditor.cpp +++ b/plugins/builtin/source/content/views/view_hexeditor.cpp @@ -937,7 +937,7 @@ namespace hex::plugin::builtin { if (ImGui::BeginTabItem("hex.builtin.view.hexeditor.goto.offset.current"_lang)) { ImGui::InputScalar("dec", ImGuiDataType_S64, &this->m_gotoAddress, nullptr, nullptr, "%lld", ImGuiInputTextFlags_CharsDecimal); - s64 currSelectionOffset = std::min(this->m_memoryEditor.DataPreviewAddr, this->m_memoryEditor.DataPreviewAddrEnd); + i64 currSelectionOffset = std::min(this->m_memoryEditor.DataPreviewAddr, this->m_memoryEditor.DataPreviewAddrEnd); if (currSelectionOffset + this->m_gotoAddress < 0) this->m_gotoAddress = -currSelectionOffset; @@ -1164,7 +1164,7 @@ namespace hex::plugin::builtin { EventManager::subscribe(this, [this](auto ®ion) { u64 address = std::min(this->m_memoryEditor.DataPreviewAddr, this->m_memoryEditor.DataPreviewAddrEnd); - size_t size = std::abs(s64(this->m_memoryEditor.DataPreviewAddrEnd) - s64(this->m_memoryEditor.DataPreviewAddr)) + 1; + size_t size = std::abs(i64(this->m_memoryEditor.DataPreviewAddrEnd) - i64(this->m_memoryEditor.DataPreviewAddr)) + 1; region = Region { address, size }; }); diff --git a/plugins/builtin/source/content/views/view_pattern_editor.cpp b/plugins/builtin/source/content/views/view_pattern_editor.cpp index b5de09080..ad018bfd0 100644 --- a/plugins/builtin/source/content/views/view_pattern_editor.cpp +++ b/plugins/builtin/source/content/views/view_pattern_editor.cpp @@ -419,9 +419,9 @@ namespace hex::plugin::builtin { ImGui::PushItemWidth(ImGui::GetContentRegionAvailWidth()); switch (type) { case EnvVarType::Integer: { - s64 displayValue = hex::get_or(value, 0); + i64 displayValue = hex::get_or(value, 0); ImGui::InputScalar("###value", ImGuiDataType_S64, &displayValue); - value = s128(displayValue); + value = i128(displayValue); break; } case EnvVarType::Float: { @@ -449,7 +449,7 @@ namespace hex::plugin::builtin { if (ImGui::IconButton(ICON_VS_ADD, ImGui::GetStyleColorVec4(ImGuiCol_Text))) { iter++; - this->m_envVarEntries.insert(iter, { this->m_envVarIdCounter++, "", s128(0), EnvVarType::Integer }); + this->m_envVarEntries.insert(iter, { this->m_envVarIdCounter++, "", i128(0), EnvVarType::Integer }); iter--; } @@ -492,9 +492,9 @@ namespace hex::plugin::builtin { ImGui::TextUnformatted(pl::Token::literalToString(variable.value, true).c_str()); } else if (variable.inVariable) { if (pl::Token::isSigned(variable.type)) { - s64 value = hex::get_or(variable.value, 0); + i64 value = hex::get_or(variable.value, 0); ImGui::InputScalar("", ImGuiDataType_S64, &value); - variable.value = s128(value); + variable.value = i128(value); } else if (pl::Token::isUnsigned(variable.type)) { u64 value = hex::get_or(variable.value, 0); ImGui::InputScalar("", ImGuiDataType_U64, &value); diff --git a/plugins/builtin/source/lang/de_DE.cpp b/plugins/builtin/source/lang/de_DE.cpp index 41e0da81d..b1e45be5b 100644 --- a/plugins/builtin/source/lang/de_DE.cpp +++ b/plugins/builtin/source/lang/de_DE.cpp @@ -360,13 +360,13 @@ namespace hex::plugin::builtin { { "hex.builtin.inspector.binary", "Binär (8 bit)" }, { "hex.builtin.inspector.u8", "uint8_t" }, - { "hex.builtin.inspector.s8", "int8_t" }, + { "hex.builtin.inspector.i8", "int8_t" }, { "hex.builtin.inspector.u16", "uint16_t" }, - { "hex.builtin.inspector.s16", "int16_t" }, + { "hex.builtin.inspector.i16", "int16_t" }, { "hex.builtin.inspector.u32", "uint32_t" }, - { "hex.builtin.inspector.s32", "int32_t" }, + { "hex.builtin.inspector.i32", "int32_t" }, { "hex.builtin.inspector.u64", "uint64_t" }, - { "hex.builtin.inspector.s64", "int64_t" }, + { "hex.builtin.inspector.i64", "int64_t" }, { "hex.builtin.inspector.float16", "half float (16 bit)" }, { "hex.builtin.inspector.float", "float (32 bit)" }, { "hex.builtin.inspector.double", "double (64 bit)" }, diff --git a/plugins/builtin/source/lang/en_US.cpp b/plugins/builtin/source/lang/en_US.cpp index 089a78f67..080279c40 100644 --- a/plugins/builtin/source/lang/en_US.cpp +++ b/plugins/builtin/source/lang/en_US.cpp @@ -363,13 +363,13 @@ namespace hex::plugin::builtin { { "hex.builtin.inspector.binary", "Binary (8 bit)" }, { "hex.builtin.inspector.u8", "uint8_t" }, - { "hex.builtin.inspector.s8", "int8_t" }, + { "hex.builtin.inspector.i8", "int8_t" }, { "hex.builtin.inspector.u16", "uint16_t" }, - { "hex.builtin.inspector.s16", "int16_t" }, + { "hex.builtin.inspector.i16", "int16_t" }, { "hex.builtin.inspector.u32", "uint32_t" }, - { "hex.builtin.inspector.s32", "int32_t" }, + { "hex.builtin.inspector.i32", "int32_t" }, { "hex.builtin.inspector.u64", "uint64_t" }, - { "hex.builtin.inspector.s64", "int64_t" }, + { "hex.builtin.inspector.i64", "int64_t" }, { "hex.builtin.inspector.float16", "half float (16 bit)" }, { "hex.builtin.inspector.float", "float (32 bit)" }, { "hex.builtin.inspector.double", "double (64 bit)" }, diff --git a/plugins/builtin/source/lang/it_IT.cpp b/plugins/builtin/source/lang/it_IT.cpp index 2ab5a7684..f0a504542 100644 --- a/plugins/builtin/source/lang/it_IT.cpp +++ b/plugins/builtin/source/lang/it_IT.cpp @@ -357,13 +357,13 @@ namespace hex::plugin::builtin { { "hex.builtin.inspector.binary", "Binary (8 bit)" }, { "hex.builtin.inspector.u8", "uint8_t" }, - { "hex.builtin.inspector.s8", "int8_t" }, + { "hex.builtin.inspector.i8", "int8_t" }, { "hex.builtin.inspector.u16", "uint16_t" }, - { "hex.builtin.inspector.s16", "int16_t" }, + { "hex.builtin.inspector.i16", "int16_t" }, { "hex.builtin.inspector.u32", "uint32_t" }, - { "hex.builtin.inspector.s32", "int32_t" }, + { "hex.builtin.inspector.i32", "int32_t" }, { "hex.builtin.inspector.u64", "uint64_t" }, - { "hex.builtin.inspector.s64", "int64_t" }, + { "hex.builtin.inspector.i64", "int64_t" }, { "hex.builtin.inspector.float16", "half float (16 bit)" }, { "hex.builtin.inspector.float", "float (32 bit)" }, { "hex.builtin.inspector.double", "double (64 bit)" }, diff --git a/plugins/builtin/source/lang/zh_CN.cpp b/plugins/builtin/source/lang/zh_CN.cpp index bde138f18..c96648f3d 100644 --- a/plugins/builtin/source/lang/zh_CN.cpp +++ b/plugins/builtin/source/lang/zh_CN.cpp @@ -358,13 +358,13 @@ namespace hex::plugin::builtin { // Use half width symbols for inspector names because displayable space { "hex.builtin.inspector.binary", "二进制(8位)" }, { "hex.builtin.inspector.u8", "uint8_t" }, - { "hex.builtin.inspector.s8", "int8_t" }, + { "hex.builtin.inspector.i8", "int8_t" }, { "hex.builtin.inspector.u16", "uint16_t" }, - { "hex.builtin.inspector.s16", "int16_t" }, + { "hex.builtin.inspector.i16", "int16_t" }, { "hex.builtin.inspector.u32", "uint32_t" }, - { "hex.builtin.inspector.s32", "int32_t" }, + { "hex.builtin.inspector.i32", "int32_t" }, { "hex.builtin.inspector.u64", "uint64_t" }, - { "hex.builtin.inspector.s64", "int64_t" }, + { "hex.builtin.inspector.i64", "int64_t" }, { "hex.builtin.inspector.float16", "半浮点(16位)" }, { "hex.builtin.inspector.float", "float(32位单精度浮点)" }, { "hex.builtin.inspector.double", "double(64位双精度浮点)" }, diff --git a/plugins/builtin/source/math_evaluator.cpp b/plugins/builtin/source/math_evaluator.cpp index f53c11b4a..ef2e52e47 100644 --- a/plugins/builtin/source/math_evaluator.cpp +++ b/plugins/builtin/source/math_evaluator.cpp @@ -11,8 +11,8 @@ namespace hex { - s16 comparePrecedence(const Operator& a, const Operator& b) { - return (static_cast(a) & 0x0F0) - (static_cast(b) & 0x0F0); + i16 comparePrecedence(const Operator& a, const Operator& b) { + return (static_cast(a) & 0x0F0) - (static_cast(b) & 0x0F0); } bool isLeftAssociative(const Operator op) { @@ -226,13 +226,13 @@ namespace hex { case Operator::Invalid: throw std::invalid_argument("Invalid operator!"); case Operator::And: - result = static_cast(leftOperand) && static_cast(rightOperand); + result = static_cast(leftOperand) && static_cast(rightOperand); break; case Operator::Or: - result = static_cast(leftOperand) && static_cast(rightOperand); + result = static_cast(leftOperand) && static_cast(rightOperand); break; case Operator::Xor: - result = (static_cast(leftOperand) ^ static_cast(rightOperand)) > 0; + result = (static_cast(leftOperand) ^ static_cast(rightOperand)) > 0; break; case Operator::GreaterThan: result = leftOperand > rightOperand; @@ -253,25 +253,25 @@ namespace hex { result = leftOperand != rightOperand; break; case Operator::Not: - result = !static_cast(rightOperand); + result = !static_cast(rightOperand); break; case Operator::BitwiseOr: - result = static_cast(leftOperand) | static_cast(rightOperand); + result = static_cast(leftOperand) | static_cast(rightOperand); break; case Operator::BitwiseXor: - result = static_cast(leftOperand) ^ static_cast(rightOperand); + result = static_cast(leftOperand) ^ static_cast(rightOperand); break; case Operator::BitwiseAnd: - result = static_cast(leftOperand) & static_cast(rightOperand); + result = static_cast(leftOperand) & static_cast(rightOperand); break; case Operator::BitwiseNot: - result = ~static_cast(rightOperand); + result = ~static_cast(rightOperand); break; case Operator::ShiftLeft: - result = static_cast(leftOperand) << static_cast(rightOperand); + result = static_cast(leftOperand) << static_cast(rightOperand); break; case Operator::ShiftRight: - result = static_cast(leftOperand) >> static_cast(rightOperand); + result = static_cast(leftOperand) >> static_cast(rightOperand); break; case Operator::Addition: result = leftOperand + rightOperand; diff --git a/tests/pattern_language/include/test_patterns/test_pattern_enums.hpp b/tests/pattern_language/include/test_patterns/test_pattern_enums.hpp index a1562a9aa..d8be52c44 100644 --- a/tests/pattern_language/include/test_patterns/test_pattern_enums.hpp +++ b/tests/pattern_language/include/test_patterns/test_pattern_enums.hpp @@ -10,7 +10,7 @@ namespace hex::test { auto testEnum = create("TestEnum", "testEnum", 0x08, sizeof(u32), nullptr); testEnum->setEnumValues({ { u128(0x0000), "A" }, - { s128(0x0C), "B" }, + { i128(0x0C), "B" }, { u128(0x0D), "C" }, { u128(0x0E), "D" }, }); diff --git a/tests/pattern_language/include/test_patterns/test_pattern_padding.hpp b/tests/pattern_language/include/test_patterns/test_pattern_padding.hpp index c931eb879..869a71596 100644 --- a/tests/pattern_language/include/test_patterns/test_pattern_padding.hpp +++ b/tests/pattern_language/include/test_patterns/test_pattern_padding.hpp @@ -7,12 +7,12 @@ namespace hex::test { class TestPatternPadding : public TestPattern { public: TestPatternPadding() : TestPattern("Padding") { - auto testStruct = create("TestStruct", "testStruct", 0x100, sizeof(s32) + 20 + sizeof(u8[0x10]), nullptr); + auto testStruct = create("TestStruct", "testStruct", 0x100, sizeof(i32) + 20 + sizeof(u8[0x10]), nullptr); - auto variable = create("s32", "variable", 0x100, sizeof(s32), nullptr); - auto padding = create("padding", "", 0x100 + sizeof(s32), 20, nullptr); - auto array = create("u8", "array", 0x100 + sizeof(s32) + 20, sizeof(u8[0x10]), nullptr); - array->setEntries(create("u8", "", 0x100 + sizeof(s32) + 20, sizeof(u8), nullptr), 0x10); + auto variable = create("s32", "variable", 0x100, sizeof(i32), nullptr); + auto padding = create("padding", "", 0x100 + sizeof(i32), 20, nullptr); + auto array = create("u8", "array", 0x100 + sizeof(i32) + 20, sizeof(u8[0x10]), nullptr); + array->setEntries(create("u8", "", 0x100 + sizeof(i32) + 20, sizeof(u8), nullptr), 0x10); testStruct->setMembers({ variable, padding, array }); diff --git a/tests/pattern_language/include/test_patterns/test_pattern_structs.hpp b/tests/pattern_language/include/test_patterns/test_pattern_structs.hpp index 7dab1c860..a38d82510 100644 --- a/tests/pattern_language/include/test_patterns/test_pattern_structs.hpp +++ b/tests/pattern_language/include/test_patterns/test_pattern_structs.hpp @@ -7,11 +7,11 @@ namespace hex::test { class TestPatternStructs : public TestPattern { public: TestPatternStructs() : TestPattern("Structs") { - auto testStruct = create("TestStruct", "testStruct", 0x100, sizeof(s32) + sizeof(u8[0x10]), nullptr); + auto testStruct = create("TestStruct", "testStruct", 0x100, sizeof(i32) + sizeof(u8[0x10]), nullptr); - auto variable = create("s32", "variable", 0x100, sizeof(s32), nullptr); - auto array = create("u8", "array", 0x100 + sizeof(s32), sizeof(u8[0x10]), nullptr); - array->setEntries(create("u8", "", 0x100 + sizeof(s32), sizeof(u8), nullptr), 0x10); + auto variable = create("s32", "variable", 0x100, sizeof(i32), nullptr); + auto array = create("u8", "array", 0x100 + sizeof(i32), sizeof(u8[0x10]), nullptr); + array->setEntries(create("u8", "", 0x100 + sizeof(i32), sizeof(u8), nullptr), 0x10); testStruct->setMembers({ variable, array });