From 54cd6dd83d5ec2e69f1a417250abca8cb75f6c3c Mon Sep 17 00:00:00 2001 From: Fardale Date: Wed, 25 Dec 2024 19:25:28 +0100 Subject: [PATCH] CCInt32(chore): add condition around functions existing in newer OCaml --- src/core/CCInt32.ml | 9 +++++++++ src/core/CCInt32.mli | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/src/core/CCInt32.ml b/src/core/CCInt32.ml index a08b23fc..45b3f4a5 100644 --- a/src/core/CCInt32.ml +++ b/src/core/CCInt32.ml @@ -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 = diff --git a/src/core/CCInt32.mli b/src/core/CCInt32.mli index 39431a33..bd1940cd 100644 --- a/src/core/CCInt32.mli +++ b/src/core/CCInt32.mli @@ -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].