mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 03:05:28 -05:00
details
This commit is contained in:
parent
e51fb2e44e
commit
8f59e8e193
2 changed files with 1 additions and 13 deletions
2
_tags
2
_tags
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue