summaryrefslogtreecommitdiff
path: root/src/gen_lib/vector.lem
diff options
context:
space:
mode:
authorChristopher2015-12-09 17:16:02 +0000
committerChristopher2015-12-09 17:16:02 +0000
commitc78d27967766480138599da36f2f3bb20f7a01c9 (patch)
treead8420407f9cd63ef1989083c47000c9f4e34a8a /src/gen_lib/vector.lem
parent3c709c896023b5952e5481311307ddecccfad83c (diff)
adapted for Kathy's lexp effect typing changes: register writes should be correct now, fixes, pp
Diffstat (limited to 'src/gen_lib/vector.lem')
-rw-r--r--src/gen_lib/vector.lem24
1 files changed, 7 insertions, 17 deletions
diff --git a/src/gen_lib/vector.lem b/src/gen_lib/vector.lem
index ad0ba1db..4044e23c 100644
--- a/src/gen_lib/vector.lem
+++ b/src/gen_lib/vector.lem
@@ -18,25 +18,15 @@ let to_bool = function
let get_start (V _ s _) = s
let length (V bs _ _) = length bs
-let rec replace bs ((n : nat),b') = match (n,bs) with
- | (_, []) -> []
- | (0, _::bs) -> b' :: bs
- | (n+1, b::bs) -> b :: replace bs (n,b')
+let rec replace bs ((n : integer),b') = match bs with
+ | [] -> []
+ | b :: bs ->
+ if n = 0 then
+ b' :: bs
+ else
+ b :: replace bs (n - 1,b')
end
-let make_indexed_vector_reg entries default start length =
- match default with
- | Just v -> V (List.foldl replace (replicate length v) entries) start
- | Nothing -> failwith "make_indexed_vector used without default value"
- end
-
-let make_indexed_vector_bit entries default start length =
- let default = match default with Nothing -> Undef | Just v -> v end in
- V (List.foldl replace (replicate length default) entries) start
-
-let make_bitvector_undef length =
- V (replicate length Undef) 0 true
-
let vector_concat (V bs start is_inc) (V bs' _ _) =
V (bs ++ bs') start is_inc