diff options
| author | Gabriel Kerneis | 2014-06-09 11:33:46 +0100 |
|---|---|---|
| committer | Gabriel Kerneis | 2014-06-09 11:34:39 +0100 |
| commit | 994f91de8d19b8923d51531bac6c0f2e01ff4a95 (patch) | |
| tree | dbf630add1887ddb20e37250ea5e1dbdc7954b52 /src/lem_interp | |
| parent | 74fd42230878b3e9c8e60f582c7382450fb36dc4 (diff) | |
| parent | 328e4fdd056abe1dba34863e389fdd9c4999fa07 (diff) | |
Merge branch 'for-dagstuhl' into master
Conflicts:
src/lem_interp/interp_lib.lem
src/lem_interp/run_interp.ml
Remove "to_vec_safe" work-around
Diffstat (limited to 'src/lem_interp')
| -rw-r--r-- | src/lem_interp/interp_lib.lem | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/lem_interp/interp_lib.lem b/src/lem_interp/interp_lib.lem index b1b3736e..18af8bfd 100644 --- a/src/lem_interp/interp_lib.lem +++ b/src/lem_interp/interp_lib.lem @@ -80,9 +80,6 @@ let exts len ((V_vector _ inc _) as v) = to_vec inc len (to_num true v) ;; -(* XXX work-around to avoid truncating *) -let to_vec_safe o l v = to_vec o 64 v ;; - let arith_op op (V_tuple args) = match args with | [V_lit(L_aux (L_num x) lx); V_lit(L_aux (L_num y) ly)] -> V_lit(L_aux (L_num (op x y)) lx) end ;; @@ -90,15 +87,24 @@ let arith_op_vec op (V_tuple args) = match args with | [(V_vector b ord cs as l1);(V_vector _ _ _ as l2)] -> let (l1',l2') = (to_num false l1,to_num false l2) in let n = arith_op op (V_tuple [l1';l2']) in - to_vec_safe ord (List.length cs) n + to_vec ord (List.length cs) n end ;; let arith_op_range_vec op (V_tuple args) = match args with | [n; (V_vector _ ord cs as l2)] -> - arith_op_vec op (V_tuple [(to_vec_safe ord (List.length cs) n);l2]) + arith_op_vec op (V_tuple [(to_vec ord (List.length cs) n);l2]) end ;; let arith_op_vec_range op (V_tuple args) = match args with | [(V_vector _ ord cs as l1);n] -> - arith_op_vec op (V_tuple [l1;(to_vec_safe ord (List.length cs) n)]) + arith_op_vec op (V_tuple [l1;(to_vec ord (List.length cs) n)]) +end ;; + +let arith_op_range_vec_range op (V_tuple args) = match args with + | [n;(V_vector _ _ _ as l2)] -> + arith_op op (V_tuple [n;(to_num true l2)]) +end ;; +let arith_op_vec_range_range op (V_tuple args) = match args with + | [(V_vector _ _ _ as l1);n] -> + arith_op op (V_tuple [(to_num true l1);n]) end ;; let compare_op op (V_tuple args) = match args with @@ -126,7 +132,9 @@ let function_map = [ ("add", arith_op (+)); ("add_vec", arith_op_vec (+)); ("add_vec_range", arith_op_vec_range (+)); + ("add_vec_range_range", arith_op_vec_range_range (+)); ("add_range_vec", arith_op_range_vec (+)); + ("add_range_vec_range", arith_op_range_vec_range (+)); ("minus", arith_op (-)); ("minus_vec", arith_op_vec (-)); ("eq", eq); |
