CCInt(chore): conditionally define function existing in newer OCaml

This commit is contained in:
Fardale 2024-12-25 19:33:40 +01:00
parent 881af122e4
commit 4781e0b7e2
2 changed files with 8 additions and 0 deletions

View file

@ -102,9 +102,13 @@ end
include Infix include Infix
[@@@iflt 4.13]
let min : t -> t -> t = Stdlib.min let min : t -> t -> t = Stdlib.min
let max : t -> t -> t = Stdlib.max let max : t -> t -> t = Stdlib.max
[@@@endif]
let floor_div a n = let floor_div a n =
if a < 0 && n >= 0 then if a < 0 && n >= 0 then
((a + 1) / n) - 1 ((a + 1) / n) - 1

View file

@ -59,6 +59,8 @@ val to_string_binary : t -> string
(** [to_string_binary x] returns the string representation of the integer [x], in binary. (** [to_string_binary x] returns the string representation of the integer [x], in binary.
@since 0.20 *) @since 0.20 *)
[@@@iflt 4.13]
val min : t -> t -> t val min : t -> t -> t
(** [min x y] returns the minimum of the two integers [x] and [y]. (** [min x y] returns the minimum of the two integers [x] and [y].
@since 0.17 *) @since 0.17 *)
@ -67,6 +69,8 @@ val max : t -> t -> t
(** [max x y] returns the maximum of the two integers [x] and [y]. (** [max x y] returns the maximum of the two integers [x] and [y].
@since 0.17 *) @since 0.17 *)
[@@@endif]
val range_by : step:t -> t -> t -> t iter val range_by : step:t -> t -> t -> t iter
(** [range_by ~step i j] iterates on integers from [i] to [j] included, (** [range_by ~step i j] iterates on integers from [i] to [j] included,
where the difference between successive elements is [step]. where the difference between successive elements is [step].