summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian Campbell2018-04-17 17:51:49 +0100
committerBrian Campbell2018-04-17 17:52:47 +0100
commitfc68bc64caa3df3e3da2456e43cfda2e7727a42c (patch)
treeabc1ee10b112bbe497791d34e7302bc0917791c6 /src
parentb62803b6a9af95aa2e0a4e7a6388db066d897b5b (diff)
Fix slicing in constant propagation
Diffstat (limited to 'src')
-rw-r--r--src/monomorphise.ml4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/monomorphise.ml b/src/monomorphise.ml
index 78ccee24..f417d292 100644
--- a/src/monomorphise.ml
+++ b/src/monomorphise.ml
@@ -779,14 +779,14 @@ let bits_of_lit = function
let slice_lit (L_aux (lit,ll)) i len (Ord_aux (ord,_)) =
let i = Big_int.to_int i in
let len = Big_int.to_int len in
+ let bin = bits_of_lit lit in
match match ord with
| Ord_inc -> Some i
- | Ord_dec -> Some (len - i)
+ | Ord_dec -> Some (String.length bin - i - len)
| Ord_var _ -> None
with
| None -> None
| Some i ->
- let bin = bits_of_lit lit in
Some (L_aux (L_bin (String.sub bin i len),Generated ll))
let concat_vec lit1 lit2 =