summaryrefslogtreecommitdiff
path: root/lang
diff options
context:
space:
mode:
Diffstat (limited to 'lang')
-rw-r--r--lang/c/pseudoc.cpp25
-rw-r--r--lang/rust/pseudorust.cpp25
2 files changed, 42 insertions, 8 deletions
diff --git a/lang/c/pseudoc.cpp b/lang/c/pseudoc.cpp
index ac1fe3bb..55a3c2c1 100644
--- a/lang/c/pseudoc.cpp
+++ b/lang/c/pseudoc.cpp
@@ -1310,9 +1310,9 @@ void PseudoCFunction::GetExprTextInternal(const HighLevelILInstruction& instr, H
std::optional<string> assignUpdateOperator;
std::optional<HighLevelILInstruction> assignUpdateSource;
bool assignUpdateNegate = false;
- const auto isSplit = destExpr.operation == HLIL_SPLIT;
+ const auto destIsSplit = destExpr.operation == HLIL_SPLIT;
std::optional<bool> assignSignedHint;
- if (isSplit)
+ if (destIsSplit)
{
const auto high = destExpr.GetHighExpr<HLIL_SPLIT>();
const auto low = destExpr.GetLowExpr<HLIL_SPLIT>();
@@ -1328,6 +1328,23 @@ void PseudoCFunction::GetExprTextInternal(const HighLevelILInstruction& instr, H
tokens.NewLine();
GetExprTextInternal(low, tokens, settings, precedence);
}
+ else if (srcExpr.operation == HLIL_SPLIT)
+ {
+ const auto high = srcExpr.GetHighExpr<HLIL_SPLIT>();
+ const auto low = srcExpr.GetLowExpr<HLIL_SPLIT>();
+ GetExprTextInternal(destExpr, tokens, settings, precedence);
+ tokens.Append(OperationToken, " = ");
+ tokens.AppendOpenParen();
+ GetExprTextInternal(high, tokens, settings, precedence);
+ tokens.Append(OperationToken, " << ");
+ tokens.Append(IntegerToken, std::to_string(low.size * 8));
+ tokens.AppendCloseParen();
+ tokens.Append(OperationToken, " | ");
+ GetExprTextInternal(low, tokens, settings, precedence);
+ tokens.AppendSemicolon();
+ tokens.NewLine();
+ return;
+ }
else
{
// Check for assignment with an operator on the same variable as the destination
@@ -1454,7 +1471,7 @@ void PseudoCFunction::GetExprTextInternal(const HighLevelILInstruction& instr, H
appearsDead = false;
}
- if (isSplit)
+ if (destIsSplit)
{
// const auto high = destExpr.GetHighExpr<HLIL_SPLIT>();
const auto low = destExpr.GetLowExpr<HLIL_SPLIT>();
@@ -1484,7 +1501,7 @@ void PseudoCFunction::GetExprTextInternal(const HighLevelILInstruction& instr, H
GetExprTextInternal(srcExpr, tokens, settings, AssignmentOperatorPrecedence, false, assignSignedHint);
}
- if (isSplit)
+ if (destIsSplit)
tokens.AppendCloseParen();
if (appearsDead)
diff --git a/lang/rust/pseudorust.cpp b/lang/rust/pseudorust.cpp
index 300297dc..e3f661fa 100644
--- a/lang/rust/pseudorust.cpp
+++ b/lang/rust/pseudorust.cpp
@@ -1371,9 +1371,9 @@ void PseudoRustFunction::GetExprText(const HighLevelILInstruction& instr, HighLe
std::optional<string> assignUpdateOperator;
std::optional<HighLevelILInstruction> assignUpdateSource;
bool assignUpdateNegate = false;
- const auto isSplit = destExpr.operation == HLIL_SPLIT;
+ const auto destIsSplit = destExpr.operation == HLIL_SPLIT;
std::optional<bool> assignSignHint;
- if (isSplit)
+ if (destIsSplit)
{
const auto high = destExpr.GetHighExpr<HLIL_SPLIT>();
const auto low = destExpr.GetLowExpr<HLIL_SPLIT>();
@@ -1389,6 +1389,23 @@ void PseudoRustFunction::GetExprText(const HighLevelILInstruction& instr, HighLe
tokens.NewLine();
GetExprText(low, tokens, settings, precedence);
}
+ else if (srcExpr.operation == HLIL_SPLIT)
+ {
+ const auto high = srcExpr.GetHighExpr<HLIL_SPLIT>();
+ const auto low = srcExpr.GetLowExpr<HLIL_SPLIT>();
+ GetExprText(destExpr, tokens, settings, precedence);
+ tokens.Append(OperationToken, " = ");
+ tokens.AppendOpenParen();
+ GetExprText(high, tokens, settings, precedence);
+ tokens.Append(OperationToken, " << ");
+ tokens.Append(IntegerToken, std::to_string(low.size * 8));
+ tokens.AppendCloseParen();
+ tokens.Append(OperationToken, " | ");
+ GetExprText(low, tokens, settings, precedence);
+ tokens.AppendSemicolon();
+ tokens.NewLine();
+ return;
+ }
else
{
// Check for assignment with an operator on the same variable as the destination
@@ -1515,7 +1532,7 @@ void PseudoRustFunction::GetExprText(const HighLevelILInstruction& instr, HighLe
appearsDead = false;
}
- if (isSplit)
+ if (destIsSplit)
{
// const auto high = destExpr.GetHighExpr<HLIL_SPLIT>();
const auto low = destExpr.GetLowExpr<HLIL_SPLIT>();
@@ -1545,7 +1562,7 @@ void PseudoRustFunction::GetExprText(const HighLevelILInstruction& instr, HighLe
GetExprText(srcExpr, tokens, settings, AssignmentOperatorPrecedence, InnerExpression, assignSignHint);
}
- if (isSplit)
+ if (destIsSplit)
tokens.AppendCloseParen();
if (appearsDead)