Skip to content

Commit

Permalink
Added comments to non-trivial code
Browse files Browse the repository at this point in the history
  • Loading branch information
jj16791 committed Oct 11, 2023
1 parent 42b07de commit 62839bf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/lib/arch/aarch64/InstructionMetadata.cc
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,9 @@ InstructionMetadata::InstructionMetadata(const cs_insn& insn)
operands[2].type = ARM64_OP_IMM;
operandCount = 3;

// Extract immediate in SVE add with immediate instruction
size_t start = operandStr.find("#");
// Identify whether the immediate value is in base-10 or base-16
if (start != std::string::npos) {
start++;
bool hex = false;
Expand All @@ -214,12 +216,12 @@ InstructionMetadata::InstructionMetadata(const cs_insn& insn)
uint8_t end = operandStr.size();
size_t shifted = operandStr.find("LSL");
if (shifted != std::string::npos) {
std::cerr << "[SimEng:arch] SVE add with immediate has shift vlaue "
std::cerr << "[SimEng:arch] SVE add with immediate has shift value "
"in operandStr which is unsupported."
<< std::endl;
exit(1);
}

// Convert extracted immediate from string to int64_t
std::string sub = operandStr.substr(start, end);
if (hex) {
operands[2].imm = std::stoul(sub, 0, 16);
Expand Down

0 comments on commit 62839bf

Please sign in to comment.