From fc68bc64caa3df3e3da2456e43cfda2e7727a42c Mon Sep 17 00:00:00 2001 From: Brian Campbell Date: Tue, 17 Apr 2018 17:51:49 +0100 Subject: Fix slicing in constant propagation --- src/monomorphise.ml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') 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 = -- cgit v1.2.3