Debian Codegraph @

kernel/uint63.mli

raw symbols SCIP
1 (************************************************************************)
2 (* * The Rocq Prover / The Rocq Development Team *)
3 (* v * Copyright INRIA, CNRS and contributors *)
4 (* <O___,, * (see version control and CREDITS file for authors & dates) *)
5 (* \VV/ **************************************************************)
6 (* // * This file is distributed under the terms of the *)
7 (* * GNU Lesser General Public License Version 2.1 *)
8 (* * (see LICENSE file for the text of the license) *)
9 (************************************************************************)
10
11 type t
12
13 val uint_size : int
14 val maxuint31 : t
15
16 (* conversion to int *)
17 val of_int : int -> t
18 val to_int2 : t -> int * int (* msb, lsb *)
19 val of_int64 : Int64.t -> t
20 val to_int64 : t -> Int64.t
21 (*
22 val of_uint : int -> t
23 *)
24 (** [int_min n m] returns the minimum of [n] and [m],
25 [m] must be in [0, 2^30-1]. *)
26 val to_int_min : t -> int -> int
27
28 (* conversion to float *)
29 val of_float : float -> t
30 val to_float : t -> float
31
32 val hash : t -> int
33
34 (* conversion to a string *)
35 val to_string : t -> string
36
37 val compile : t -> string
38
39 (* constants *)
40 val zero : t
41 val one : t
42
43 (* logical operations *)
44 val l_sl : t -> t -> t
45 val l_sr : t -> t -> t
46 val l_and : t -> t -> t
47 val l_xor : t -> t -> t
48 val l_or : t -> t -> t
49
50 (* Arithmetic operations *)
51 val a_sr : t -> t -> t
52 val add : t -> t -> t
53 val sub : t -> t -> t
54 val mul : t -> t -> t
55 val div : t -> t -> t
56 val rem : t -> t -> t
57
58 val diveucl : t -> t -> t * t
59
60 (* Signed arithmetic opeartions *)
61 val divs : t -> t -> t
62 val rems : t -> t -> t
63
64 (* Specific arithmetic operations *)
65 val mulc : t -> t -> t * t
66 val addmuldiv : t -> t -> t -> t
67
68 (** [div21 xh xl y] returns [q % 2^63, r]
69 s.t. [xh * 2^63 + xl = q * y + r] and [r < y].
70 When [y] is [0], returns [0, 0]. *)
71 val div21 : t -> t -> t -> t * t
72
73 (* comparison *)
74 val lt : t -> t -> bool
75 val equal : t -> t -> bool
76 val le : t -> t -> bool
77 val compare : t -> t -> int
78
79 (* signed comparision *)
80 val lts : t -> t -> bool
81 val les : t -> t -> bool
82 val compares : t -> t -> int
83
84 (* head and tail *)
85 val head0 : t -> t
86 val tail0 : t -> t
87
88 val is_uint63 : Obj.t -> bool
89
90 (* Arithmetic with explicit carries *)
91
92 (* Analog of Numbers.Abstract.Cyclic.carry *)
93 type 'a carry = C0 of 'a | C1 of 'a
94
95 val addc : t -> t -> t carry
96 val addcarryc : t -> t -> t carry
97 val subc : t -> t -> t carry
98 val subcarryc : t -> t -> t carry