summaryrefslogtreecommitdiff
path: root/arch/powerpc/util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/util.cpp')
-rw-r--r--arch/powerpc/util.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/arch/powerpc/util.cpp b/arch/powerpc/util.cpp
index 50c3eb5b..5e37f735 100644
--- a/arch/powerpc/util.cpp
+++ b/arch/powerpc/util.cpp
@@ -85,4 +85,17 @@ void printInstructionVerbose(decomp_result *res)
}
}
+uint64_t sign_extend(size_t addressSize_local, uint64_t target, int signBit)
+{
+ if ((target >> signBit) & 1)
+ {
+ target = target | (~((1 << signBit) - 1));
+ }
+
+ if (addressSize_local == 4)
+ {
+ target = target & 0xffffffff;
+ }
+ return target;
+}