-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinteger.mli
55 lines (43 loc) · 1.7 KB
/
integer.mli
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
(* This module provides access to several of the operations defined in
Objective Caml's standard library module [Int32], under the names
usually reserved for operations on integers of type [int]. This
allows switching from 31- or 63-bit arithmetic to 32-bit
arithmetic. *)
val (+): int32 -> int32 -> int32
val (-): int32 -> int32 -> int32
val ( * ): int32 -> int32 -> int32
val (/): int32 -> int32 -> int32
val (mod): int32 -> int32 -> int32
val (land): int32 -> int32 -> int32
val (lor): int32 -> int32 -> int32
val (lxor): int32 -> int32 -> int32
val (lsl): int32 -> int -> int32
val (asr): int32 -> int -> int32
val (lsr): int32 -> int -> int32
val (<=): int32 -> int32 -> bool
val (<): int32 -> int32 -> bool
val (>=): int32 -> int32 -> bool
val (>): int32 -> int32 -> bool
val (~-): int32 -> int32
val max: int32 -> int32 -> int32
val max_int: int32
val min_int: int32
(* ------------------------------------------------------------------------- *)
(* Here are some extra operations. *)
(* [fits16 i] tells whether [i] fits in 16 bits, that is, whether it
lies within the range [-2^15 .. 2^15 - 1]. *)
val fits16: int32 -> bool
(* [is_power_of_two i] tells whether [i] is a positive power of 2. In
that case, [log2 i] is its logarithm. [exp2 i] is two to the [i]. *)
val is_power_of_two: int32 -> bool
val log2: int32 -> int32
val exp2: int32 -> int32
(* ------------------------------------------------------------------------- *)
(* Here are some operations on arrays with 32-bit indices. *)
module Array : sig
val make: int32 -> 'a -> 'a array
val init: int32 -> (int32 -> 'a) -> 'a array
val get: 'a array -> int32 -> 'a
val set: 'a array -> int32 -> 'a -> unit
val length: 'a array -> int32
end