From 4a33ec8bcc5ba803eb48c6ba3695dd7863731050 Mon Sep 17 00:00:00 2001 From: Raul Zaharia Date: Tue, 1 Aug 2023 20:58:16 +0300 Subject: [PATCH] dissasm fix merge 2 --- .../src/View/DissasmViewer/DissasmX86.cpp | 57 ------------------- 1 file changed, 57 deletions(-) diff --git a/GViewCore/src/View/DissasmViewer/DissasmX86.cpp b/GViewCore/src/View/DissasmViewer/DissasmX86.cpp index 408b4bd9..45e56605 100644 --- a/GViewCore/src/View/DissasmViewer/DissasmX86.cpp +++ b/GViewCore/src/View/DissasmViewer/DissasmX86.cpp @@ -493,63 +493,6 @@ inline bool populateOffsetsVector( return true; } -// TODO: maybe add also minimum number? -bool CheckExtractInsnHexValue(cs_insn& insn, uint64& value, uint64 maxSize) -{ - char* ptr = insn.op_str; - char* start = nullptr; - uint32 size = 0; - - while (ptr && *ptr != '\0') - { - if (!start) - { - if (ptr && *ptr == '0') - { - ptr++; - if (!ptr || *ptr != 'x') - return false; - ptr++; - start = ptr; - continue; - } - } - else - { - if ((*ptr >= '0' && *ptr <= '9') || (*ptr >= 'a' && *ptr <= 'f')) - { - size++; - } - else - { - if (size < maxSize - 2) - return false; - break; - } - } - ptr++; - } - - if (maxSize < size) - { - const uint32 diff = size - static_cast(maxSize); - size -= diff; - start += diff; - } - - if (!start || !ptr || size < 2) - return false; - - const auto sv = std::string_view(start, size); - const auto converted = Number::ToUInt64(sv, NumberParseFlags::Base16); - if (!converted.has_value()) - return false; - - value = converted.value(); - - return true; -} - inline cs_insn* GetCurrentInstructionByLine( uint32 lineToReach, DissasmCodeZone* zone, Reference obj, uint32& diffLines, DrawLineInfo* dli = nullptr) {