source: extracted/untrusted/glue.ml @ 2740

Last change on this file since 2740 was 2740, checked in by sacerdot, 7 years ago

Graph colouring terminated up to Uses that will be implemented
in Matita.

File size: 479 bytes
Line 
1let int_of_bitvector v =
2  let rec aux pow v =
3    match v with
4      Vector.VEmpty -> 0
5    | Vector.VCons (_,hd,tl) ->
6        if hd = Bool.True then
7          pow + (aux (pow * 2) tl)
8        else
9          aux (pow * 2) tl
10  in
11    aux 1 (Vector.reverse0 Nat.O v)
12
13let option_of_matitaoption =
14 function
15    Types.None -> None
16  | Types.Some v -> Some v
17
18let rec matitanat_of_int n =
19 if n = 0 then Nat.O
20 else if n < 0 then assert false
21 else Nat.S (matitanat_of_int (n-1))
Note: See TracBrowser for help on using the repository browser.