diff options
Diffstat (limited to 'reg.ml')
-rw-r--r-- | reg.ml | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -7,10 +7,11 @@ open Common | |||
7 | 7 | ||
8 | let reg_idx (Reg(idx, _)) = idx | 8 | let reg_idx (Reg(idx, _)) = idx |
9 | let reg_val (Reg(_, value)) = value | 9 | let reg_val (Reg(_, value)) = value |
10 | let reg_compar reg1 reg2 = (reg_val reg1) - (reg_val reg2) | 10 | let reg_compar l r = (reg_val l) - (reg_val r) |
11 | 11 | ||
12 | let regs_get reglist idx = | 12 | let 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 | ||
15 | let regs_set reglist index value = | 15 | let 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 | |||