summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKathy Gray2015-01-14 16:28:42 +0000
committerKathy Gray2015-01-14 16:28:42 +0000
commitb786b300aa133ae436b582c25dd2e965b563fa54 (patch)
tree2a371e6c764a3de414685a42c07a06ba3ba5d77a /src
parent8a371efeab0792b370da7764a290b14a1d21b83a (diff)
correct where overflow checking should happen on multiplication arithmetic
Diffstat (limited to 'src')
-rw-r--r--src/lem_interp/interp_lib.lem7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/lem_interp/interp_lib.lem b/src/lem_interp/interp_lib.lem
index 8ec9e983..294b7421 100644
--- a/src/lem_interp/interp_lib.lem
+++ b/src/lem_interp/interp_lib.lem
@@ -317,7 +317,8 @@ let rec arith_op_overflow_vec op over_typ sign size (V_tuple [vl;vr]) =
let overflow_help vl vr =
match (vl,vr) with
| (V_vector b ord cs1,V_vector _ _ cs2) ->
- let act_size = (List.length cs1) * size in
+ let len = List.length cs1 in
+ let act_size = len * size in
let (is_l1_unknown,is_l2_unknown) = ((has_unknown vl), (has_unknown vr)) in
if is_l1_unknown || is_l2_unknown
then (V_tuple [ (to_vec ord act_size V_unknown);V_unknown;V_unknown])
@@ -330,8 +331,8 @@ let rec arith_op_overflow_vec op over_typ sign size (V_tuple [vl;vr]) =
let one_more_size_u = to_vec ord (act_size +1) n_unsign in
let overflow = (match n with
| V_lit (L_aux (L_num n') ln) ->
- if (n' <= (get_max_representable_in act_size)) &&
- (n' >= (get_min_representable_in act_size))
+ if (n' <= (get_max_representable_in len)) &&
+ (n' >= (get_min_representable_in len))
then V_lit (L_aux L_zero ln)
else V_lit (L_aux L_one ln) end) in
let out_num = to_num sign correct_size_num in