CCInt32(chore): add condition around functions existing in newer OCaml

This commit is contained in:
Fardale 2024-12-25 19:25:28 +01:00
parent 13252a9513
commit 54cd6dd83d
2 changed files with 16 additions and 0 deletions

View file

@ -2,9 +2,18 @@
include Int32
[@@@iflt 4.13]
let min : t -> t -> t = Stdlib.min
let max : t -> t -> t = Stdlib.max
[@@@endif]
[@@@iflt 5.1]
let hash x = Stdlib.abs (to_int x)
[@@@endif]
let sign i = compare i zero
let pow a b =

View file

@ -18,6 +18,8 @@ include module type of struct
include Int32
end
[@@@iflt 4.13]
val min : t -> t -> t
(** [min x y] returns the minimum of the two integers [x] and [y].
@since 3.0 *)
@ -26,10 +28,15 @@ val max : t -> t -> t
(** [max x y] returns the maximum of the two integers [x] and [y].
@since 3.0 *)
[@@@endif]
[@@@iflt 5.1]
val hash : t -> int
(** [hash x] computes the hash of [x].
Like {!Stdlib.abs (to_int x)}. *)
[@@@endif]
val sign : t -> int
(** [sign x] return [0] if [x = 0], [-1] if [x < 0] and [1] if [x > 0].
Same as [compare x zero].