diff --git a/core/CCInt.ml b/core/CCInt.ml index fecaac00..478e105a 100644 --- a/core/CCInt.ml +++ b/core/CCInt.ml @@ -30,6 +30,8 @@ let equal a b = a=b let compare a b = Pervasives.compare a b +let hash i = i land max_int + let sign i = if i < 0 then -1 else if i>0 then 1 diff --git a/core/CCInt.mli b/core/CCInt.mli index df4a34fd..11b7abc7 100644 --- a/core/CCInt.mli +++ b/core/CCInt.mli @@ -32,6 +32,8 @@ val compare : t -> t -> int val equal : t -> t -> bool +val hash : t -> int + val sign : t -> int (** [sign i] is one of [-1, 0, 1] *)