Commit c10d9e2e authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2003-01-12 20:40:54 by cvscast] Empty log message

Original author: cvscast
Date: 2003-01-12 20:40:54+00:00
parent cbd9371b
...@@ -20,21 +20,21 @@ struct ...@@ -20,21 +20,21 @@ struct
type t = int type t = int
type value = H.t type value = H.t
let cache = Hashtbl.create 63 let cache = State.ref "Pool.cache" (Hashtbl.create 63)
let values = State.ref "Pool.values" (Array.create 63 None) let values = State.ref "Pool.values" (Array.create 63 None)
let counter = State.ref "Pool.counter" 0 let counter = State.ref "Pool.counter" 0
let clear () = let clear () =
Hashtbl.clear cache; Hashtbl.clear !cache;
values := Array.create 63 None; values := Array.create 63 None;
counter := 0 counter := 0
let mk x = let mk x =
try Hashtbl.find cache x try Hashtbl.find !cache x
with Not_found -> with Not_found ->
let n = !counter in let n = !counter in
incr counter; incr counter;
Hashtbl.add cache x n; Hashtbl.add !cache x n;
if (n = Array.length !values) then if (n = Array.length !values) then
( (
let new_values = Array.create (2 * Array.length !values) None in let new_values = Array.create (2 * Array.length !values) None in
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment