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