aboutsummaryrefslogtreecommitdiff
path: root/reg.ml
diff options
context:
space:
mode:
Diffstat (limited to 'reg.ml')
-rw-r--r--reg.ml16
1 files changed, 16 insertions, 0 deletions
diff --git a/reg.ml b/reg.ml
new file mode 100644
index 0000000..b27a868
--- /dev/null
+++ b/reg.ml
@@ -0,0 +1,16 @@
1(*
2 * UPEM / L3 / Functional programming / Project: URM
3 * Pacien TRAN-GIRARD, Adam NAILI
4 *)
5
6open Common
7
8let reg_idx (Reg(idx, _)) = idx
9let reg_val (Reg(_, value)) = value
10let reg_compar reg1 reg2 = (reg_val reg1) - (reg_val reg2)
11
12let regs_get reglist idx =
13 List.find (fun (Reg(x,v)) -> x = idx) reglist |> reg_val
14
15let regs_set reglist index value =
16 Reg(index, value) :: List.filter (fun (Reg(x, v)) -> x != index) reglist