blob: b27a868839c55351e6631efc31db921e7f74fcdb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
(*
* UPEM / L3 / Functional programming / Project: URM
* Pacien TRAN-GIRARD, Adam NAILI
*)
open Common
let reg_idx (Reg(idx, _)) = idx
let reg_val (Reg(_, value)) = value
let reg_compar reg1 reg2 = (reg_val reg1) - (reg_val reg2)
let regs_get reglist idx =
List.find (fun (Reg(x,v)) -> x = idx) reglist |> reg_val
let regs_set reglist index value =
Reg(index, value) :: List.filter (fun (Reg(x, v)) -> x != index) reglist
|