diff paraspace/dalvik_opcodes.py @ 73:6d56483b56cd

Round size of encoded Dalvik instructions to 2 times. - Append '\x00's to the tail of instructions
author Thinker K.F. Li <thinker@codemud.net>
date Sat, 02 Jul 2011 00:09:50 +0800
parents 6c2efdeffa7b
children 9a64fa2d78b7
line wrap: on
line diff
--- a/paraspace/dalvik_opcodes.py	Sat Jul 02 00:03:17 2011 +0800
+++ b/paraspace/dalvik_opcodes.py	Sat Jul 02 00:09:50 2011 +0800
@@ -1196,12 +1196,12 @@
     arg_part = ''.join([encode_arg(arg, sz)
                         for arg, sz in map(None, args, fmt_parse_cfg)])
 
+    while encode_arg.off % 4:
+        arg_part = arg_part + encode_arg(0, 1)
+        pass
+    
     inst = chr(opcode) + arg_part
 
-    while len(inst) % 2:
-        encode_arg(0, 1)
-        pass
-    
     return inst