aboutsummaryrefslogtreecommitdiff
path: root/reg.ml
diff options
context:
space:
mode:
Diffstat (limited to 'reg.ml')
-rw-r--r--reg.ml9
1 files changed, 5 insertions, 4 deletions
diff --git a/reg.ml b/reg.ml
index b27a868..c452282 100644
--- a/reg.ml
+++ b/reg.ml
@@ -7,10 +7,11 @@ open Common
7 7
8let reg_idx (Reg(idx, _)) = idx 8let reg_idx (Reg(idx, _)) = idx
9let reg_val (Reg(_, value)) = value 9let reg_val (Reg(_, value)) = value
10let reg_compar reg1 reg2 = (reg_val reg1) - (reg_val reg2) 10let reg_compar l r = (reg_val l) - (reg_val r)
11 11
12let regs_get reglist idx = 12let regs_get reglist index =
13 List.find (fun (Reg(x,v)) -> x = idx) reglist |> reg_val 13 List.find (fun (Reg(idx, _)) -> idx = index) reglist |> reg_val
14 14
15let regs_set reglist index value = 15let regs_set reglist index value =
16 Reg(index, value) :: List.filter (fun (Reg(x, v)) -> x != index) reglist 16 Reg(index, value) :: List.filter (fun (Reg(idx, _)) -> idx != index) reglist
17