From 50cbe2b0cd107e705cdeb0dc8b16ba5cafa26f45 Mon Sep 17 00:00:00 2001 From: puech Date: Fri, 29 Jul 2011 14:27:20 +0000 Subject: Hahtbl_alt: separate generic combine functions ... and report changes on Term git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@14344 85f007b7-540e-0410-9357-904b9bb8a0f7 --- lib/hashtbl_alt.ml | 8 +++----- lib/hashtbl_alt.mli | 7 +++++-- 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/hashtbl_alt.ml b/lib/hashtbl_alt.ml index 667f4f7193..e6843174ae 100644 --- a/lib/hashtbl_alt.ml +++ b/lib/hashtbl_alt.ml @@ -29,10 +29,6 @@ module type S = sig [constr] is stored in [H] and will be used as the canonical representation of this value in the future. *) val may_add_and_get : int -> elt -> elt - val combine : int -> int -> int - val combinesmall : int -> int -> int - val combine3 : int -> int -> int -> int - val combine4 : int -> int -> int -> int -> int end module Make (E : Hashtype) = @@ -96,6 +92,9 @@ module Make (E : Hashtype) = if hash == h2 && E.equals key k3 then k3 else find_rec hash key rest3 +end + +module Combine = struct (* These are helper functions to combine the hash keys in a similar way as [Hashtbl.hash] does. The constants [alpha] and [beta] must be prime numbers. There were chosen empirically. Notice that the @@ -107,5 +106,4 @@ module Make (E : Hashtype) = let combine3 x y z = combine x (combine y z) let combine4 x y z t = combine x (combine3 y z t) let combinesmall x y = beta * x + y - end diff --git a/lib/hashtbl_alt.mli b/lib/hashtbl_alt.mli index 47255fc9db..96dffb2cb0 100644 --- a/lib/hashtbl_alt.mli +++ b/lib/hashtbl_alt.mli @@ -29,10 +29,13 @@ module type S = sig [constr] is stored in [H] and will be used as the canonical representation of this value in the future. *) val may_add_and_get : int -> elt -> elt +end + +module Make (E : Hashtype) : S with type elt = E.t + +module Combine : sig val combine : int -> int -> int val combinesmall : int -> int -> int val combine3 : int -> int -> int -> int val combine4 : int -> int -> int -> int -> int end - -module Make (E : Hashtype) : S with type elt = E.t -- cgit v1.2.3