Skip to content

Commit d3e085e

Browse files
committed
CCInt(cleanup): remove function always present on 4.08
1 parent 24b57f9 commit d3e085e

File tree

2 files changed

+0
-141
lines changed

2 files changed

+0
-141
lines changed

src/core/CCInt.ml

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,8 @@
22

33
include Int
44

5-
type t = int
65
type 'a iter = ('a -> unit) -> unit
76

8-
let zero = 0
9-
let one = 1
10-
let minus_one = -1
11-
let add = ( + )
12-
let sub = ( - )
13-
let mul = ( * )
14-
let div = ( / )
15-
let succ = succ
16-
let pred = pred
17-
let abs = abs
18-
let max_int = max_int
19-
let min_int = min_int
20-
let equal (a : int) b = Stdlib.( = ) a b
21-
let compare (a : int) b = compare a b
22-
237
(* use FNV:
248
https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function *)
259
let hash (n : int) : int =
@@ -65,7 +49,6 @@ let range' i j yield =
6549
range i (j + 1) yield
6650

6751
let sign i = compare i 0
68-
let neg i = -i
6952

7053
let pow a b =
7154
let rec aux acc = function
@@ -147,11 +130,8 @@ let random_small = random 100
147130
let random_range i j st = i + random (j - i) st
148131
let pp fmt = Format.pp_print_int fmt
149132
let most_significant_bit = -1 lxor (-1 lsr 1)
150-
let to_string = string_of_int
151133
let of_string s = try Some (int_of_string s) with Failure _ -> None
152134
let of_string_exn = Stdlib.int_of_string
153-
let to_float = float_of_int
154-
let of_float = int_of_float
155135

156136
type output = char -> unit
157137

@@ -248,11 +228,3 @@ let popcount (b : int) : int =
248228
let b = add b (shift_right_logical b 32) in
249229
let b = logand b 0x7fL in
250230
to_int b
251-
252-
let logand = ( land )
253-
let logor = ( lor )
254-
let logxor = ( lxor )
255-
let lognot = lnot
256-
let shift_left = ( lsl )
257-
let shift_right = ( asr )
258-
let shift_right_logical = ( lsr )

src/core/CCInt.mli

Lines changed: 0 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -5,77 +5,13 @@
55
include module type of Int
66
(** @inline *)
77

8-
type t = int
9-
10-
val zero : t
11-
(** [zero] is the integer [0].
12-
@since 3.0 *)
13-
14-
val one : t
15-
(** [one] is the integer [1].
16-
@since 3.0 *)
17-
18-
val minus_one : t
19-
(** [minus_one] is the integer [-1].
20-
@since 3.0 *)
21-
22-
val add : t -> t -> t
23-
(** [add x y] is [x + y].
24-
@since 3.0 *)
25-
26-
val sub : t -> t -> t
27-
(** [sub x y] is [x - y].
28-
@since 3.0 *)
29-
30-
val mul : t -> t -> t
31-
(** [mul x y] is [x * y].
32-
@since 3.0 *)
33-
34-
val div : t -> t -> t
35-
(** [div x y] is [x / y]
36-
@since 3.0 *)
37-
38-
val succ : t -> t
39-
(** [succ x] is [x + 1].
40-
@since 3.0 *)
41-
42-
val pred : t -> t
43-
(** [pred x] is [x - 1].
44-
@since 3.0 *)
45-
46-
val abs : t -> t
47-
(** [abs x] is the absolute value of [x]. It is [x] if [x] is positive
48-
and [neg x] otherwise.
49-
@since 3.0 *)
50-
51-
val max_int : t
52-
(** [max_int] is the maximum integer.
53-
@since 3.0 *)
54-
55-
val min_int : t
56-
(** [min_int] is the minimum integer.
57-
@since 3.0 *)
58-
59-
val compare : t -> t -> int
60-
(** [compare x y] is the comparison function for integers
61-
with the same specification as {!Stdlib.compare}. *)
62-
63-
val equal : t -> t -> bool
64-
(** [equal x y] is [true] iff [x] and [y] are equal.
65-
Equality function for integers. *)
66-
678
val hash : t -> int
689
(** [hash x] computes the hash of [x]. *)
6910

7011
val sign : t -> int
7112
(** [sign x] return [0] if [x = 0], [-1] if [x < 0] and [1] if [x > 0].
7213
Same as [compare x 0].*)
7314

74-
val neg : t -> t
75-
(** [neg x] is [- x].
76-
Unary negation.
77-
@since 0.5 *)
78-
7915
val pow : t -> t -> t
8016
(** [pow base exponent] returns [base] raised to the power of [exponent].
8117
[pow x y = x^y] for positive integers [x] and [y].
@@ -103,22 +39,6 @@ val random_range : int -> int -> t random_gen
10339
val pp : t printer
10440
(** [pp ppf x] prints the integer [x] on [ppf]. *)
10541

106-
val to_float : t -> float
107-
(** [to_float] is the same as [float_of_int]
108-
@since 3.0*)
109-
110-
[@@@ocaml.warning "-32"]
111-
112-
val of_float : float -> t
113-
(** [to_float] is the same as [int_of_float]
114-
@since 3.0*)
115-
116-
[@@@ocaml.warning "+32"]
117-
118-
val to_string : t -> string
119-
(** [to_string x] returns the string representation of the integer [x], in signed decimal.
120-
@since 0.13 *)
121-
12242
val of_string : string -> t option
12343
(** [of_string s] converts the given string [s] into an integer.
12444
Safe version of {!of_string_exn}.
@@ -130,11 +50,6 @@ val of_string_exn : string -> t
13050
@raise Failure in case of failure.
13151
@since 3.0 *)
13252

133-
val of_float : float -> t
134-
(** [of_float x] converts the given floating-point number [x] to an integer.
135-
Alias to {!int_of_float}.
136-
@since 3.0 *)
137-
13853
val pp_binary : t printer
13954
(** [pp_binary ppf x] prints [x] on [ppf].
14055
Print as "0b00101010".
@@ -173,34 +88,6 @@ val popcount : t -> int
17388
(** Number of bits set to 1
17489
@since 3.0 *)
17590

176-
val logand : t -> t -> t
177-
(** [logand] is the same as [(land)].
178-
@since 3.0 *)
179-
180-
val logor : t -> t -> t
181-
(** [logand] is the same as [(lor)].
182-
@since 3.0 *)
183-
184-
val logxor : t -> t -> t
185-
(** [logxor] is the same as [(lxor)].
186-
@since 3.0 *)
187-
188-
val lognot : t -> t
189-
(** [logand] is the same as [lnot].
190-
@since 3.0 *)
191-
192-
val shift_left : t -> int -> t
193-
(** [shift_left] is the same as [(lsl)].
194-
@since 3.0 *)
195-
196-
val shift_right : t -> int -> t
197-
(** [shift_right] is the same as [(asr)].
198-
@since 3.0 *)
199-
200-
val shift_right_logical : t -> int -> t
201-
(** [shift_right_logical] is the same as [(lsr)].
202-
@since 3.0 *)
203-
20491
(** {2 Infix Operators}
20592
20693
@since 0.17 *)

0 commit comments

Comments
 (0)