about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorFabrice Desclaux <fabrice.desclaux@cea.fr>2018-03-05 11:23:35 +0100
committerFabrice Desclaux <fabrice.desclaux@cea.fr>2018-03-05 11:23:35 +0100
commit5d5c768db62da037d156808f528cf9c1e14db8ab (patch)
tree683728881150e2406849bcc1e1c13c62bc0b6d44
parent5155171ab9b805d26824fe1248840f4ac22de94c (diff)
downloadmiasm-5d5c768db62da037d156808f528cf9c1e14db8ab.tar.gz
miasm-5d5c768db62da037d156808f528cf9c1e14db8ab.zip
LLVM: fix rot 0
-rw-r--r--miasm2/jitter/llvmconvert.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/miasm2/jitter/llvmconvert.py b/miasm2/jitter/llvmconvert.py
index 9796b265..0e4368a8 100644
--- a/miasm2/jitter/llvmconvert.py
+++ b/miasm2/jitter/llvmconvert.py
@@ -777,8 +777,10 @@ class LLVMFunction():
                 itype = LLVMType.IntType(expr.size)
                 expr_size = itype(expr.size)
 
+                # As shift of expr_size is undefined, we urem the shifters
                 shift = builder.urem(count, expr_size)
-                shift_inv = builder.sub(expr_size, shift)
+                shift_inv = builder.urem(builder.sub(expr_size, shift),
+                                         expr_size)
 
                 if op == '<<<':
                     part_a = builder.shl(value, shift)