This commit is contained in:
Simon Cruanes 2015-09-02 19:37:10 +02:00
parent e51fb2e44e
commit 8f59e8e193
2 changed files with 1 additions and 13 deletions

2
_tags
View file

@ -3,6 +3,6 @@
<tests/*.ml{,i}>: thread
<src/threads/*.ml{,i}>: thread
<src/core/CCVector.cmx>: inline(25)
<src/data/CCFlatHashtbl.cm*>: inline(15)
<src/data/CCFlatHashtbl.cm*> or <src/data/CCHashTrie.cm*>: inline(15)
<src/**/*.ml> and not <src/misc/*.ml>: warn_A, warn(-4), warn(-44)
true: no_alias_deps, safe_string

View file

@ -145,23 +145,11 @@ module Hash : sig
val make_unsafe : int -> t
val rem : t -> int (* 3 last bits *)
val quotient : t -> t (* remove 3 last bits *)
val combine : t -> int -> t (* add 3 last bits *)
end = struct
type t = int
let make_unsafe i = i
let rem h = h land 7
let quotient h = h lsr 3
let combine h r = h lsl 3 lor r
(* safety checks *)
let () =
assert (
List.for_all
(fun n ->
let q = quotient n and r = rem n in
n = combine q r
) [1;2;3;4;10;205;295;4262;1515;67;8;99;224;]
)
end
module Make(Key : KEY)