aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorpuech2011-07-29 14:27:20 +0000
committerpuech2011-07-29 14:27:20 +0000
commit50cbe2b0cd107e705cdeb0dc8b16ba5cafa26f45 (patch)
treefeaa3d423310600bc0464a40608ed57d273f17df /lib
parentddcc36cc2ef44a40a2f636f1096c63f4043c8959 (diff)
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
Diffstat (limited to 'lib')
-rw-r--r--lib/hashtbl_alt.ml8
-rw-r--r--lib/hashtbl_alt.mli7
2 files changed, 8 insertions, 7 deletions
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