Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 51 lines (38 sloc) 1.577 kb
4c151a9 Adam Koprowski [feature] Int.t: introducing 64-bit integer type.
akoprow authored
1 (*
2 Copyright © 2011 MLstate
3
4 This file is part of OPA.
5
6 OPA is free software: you can redistribute it and/or modify it under the
7 terms of the GNU Affero General Public License, version 3, as published by
8 the Free Software Foundation.
9
10 OPA is distributed in the hope that it will be useful, but WITHOUT ANY
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
13 more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with OPA. If not, see <http://www.gnu.org/licenses/>.
17 *)
18
19 (**
20 * This module provides 64-bit signed integers. It should be used in place
21 * of [int] when this extra bit is required (int's are 63-bit) *and* to make
22 * sure everything works on 32-bit platforms (where this type will still provide
23 * 64-bits).
24 * In short this should be used in place of int's when dealing with values
25 * that may exceed 31 bits.
26 * Performance notice: value of type Int.t will occupy more space and
27 * operations on them will generally be slower than over the int type.
28 *)
29
30 (** A 64-bit integer (also on 32-bit platforms). *)
31 type t
32
33 (** Addition *)
34 val ( + ): t -> t -> t
35
36 (** Subtraction *)
37 val ( - ): t -> t -> t
38
39 (** Multiplication *)
40 val ( * ): t -> t -> t
41
42 (** Integer division *)
43 val ( / ): t -> t -> t
44
45 (** Conversion from native integer *)
46 val of_int: int -> t
47
48 exception Overflow
49 (** Conversion to native integer; throws Overflow if the value does not fit *)
50 val to_int: t -> int
Something went wrong with that request. Please try again.