projects
/
SXSI
/
xpathcomp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Safety commit
[SXSI/xpathcomp.git]
/
ptset.ml
diff --git
a/ptset.ml
b/ptset.ml
index
4fc92d6
..
68f7e2e
100644
(file)
--- a/
ptset.ml
+++ b/
ptset.ml
@@
-14,14
+14,14
@@
sig
val is_singleton : t -> bool
val mem_union : t -> t -> t
val hash : t -> int
val is_singleton : t -> bool
val mem_union : t -> t -> t
val hash : t -> int
- val uid : t ->
in
t
+ val uid : t ->
Uid.
t
val uncons : t -> elt*t
val from_list : elt list -> t
val make : data -> t
val node : t -> data
end
val uncons : t -> elt*t
val from_list : elt list -> t
val make : data -> t
val node : t -> data
end
-module Make ( H : Hcons.S ) : S with type elt = H.t =
+module Make ( H : Hcons.S
A
) : S with type elt = H.t =
struct
type elt = H.t
type 'a node =
struct
type elt = H.t
type 'a node =
@@
-44,8
+44,8
@@
struct
| _ -> false
let hash = function
| Empty -> 0
| _ -> false
let hash = function
| Empty -> 0
- | Leaf i -> HASHINT2(HALF_MAX_INT,
H.uid i
)
- | Branch (b,i,l,r) -> HASHINT4(b,i,
HNode.uid l, HNode.uid r
)
+ | Leaf i -> HASHINT2(HALF_MAX_INT,
Uid.to_int (H.uid i)
)
+ | Branch (b,i,l,r) -> HASHINT4(b,i,
Uid.to_int l.HNode.id, Uid.to_int r.HNode.id
)
end
;;
end
;;
@@
-79,7
+79,7
@@
struct
| _ -> false
let mem (k:elt) n =
| _ -> false
let mem (k:elt) n =
- let kid =
H.uid k
in
+ let kid =
Uid.to_int (H.uid k)
in
let rec loop n = match HNode.node n with
| Empty -> false
| Leaf j -> k == j
let rec loop n = match HNode.node n with
| Empty -> false
| Leaf j -> k == j
@@
-142,10
+142,10
@@
END
let match_prefix k p m = (mask k m) == p
let add k t =
let match_prefix k p m = (mask k m) == p
let add k t =
- let kid =
H.uid k
in
+ let kid =
Uid.to_int (H.uid k)
in
let rec ins n = match HNode.node n with
| Empty -> leaf k
let rec ins n = match HNode.node n with
| Empty -> leaf k
- | Leaf j -> if j == k then n else join kid (leaf k) (
H.uid j
) n
+ | Leaf j -> if j == k then n else join kid (leaf k) (
Uid.to_int (H.uid j)
) n
| Branch (p,m,t0,t1) ->
if match_prefix kid p m then
if zero_bit kid m then
| Branch (p,m,t0,t1) ->
if match_prefix kid p m then
if zero_bit kid m then
@@
-158,7
+158,7
@@
END
ins t
let remove k t =
ins t
let remove k t =
- let kid =
H.uid k
in
+ let kid =
Uid.to_int(H.uid k)
in
let rec rmv n = match HNode.node n with
| Empty -> empty
| Leaf j -> if k == j then empty else n
let rec rmv n = match HNode.node n with
| Empty -> empty
| Leaf j -> if k == j then empty else n
@@
-177,7
+177,7
@@
END
let equal a b = HNode.equal a b
let equal a b = HNode.equal a b
- let compare a b = (
HNode.uid a) - (HNode.uid b
)
+ let compare a b = (
Uid.to_int (HNode.uid a)) - (Uid.to_int (HNode.uid b)
)
let rec merge s t =
if (equal s t) (* This is cheap thanks to hash-consing *)
let rec merge s t =
if (equal s t) (* This is cheap thanks to hash-consing *)
@@
-386,8
+386,8
@@
struct
include Make ( struct type t = int
type data = t
external hash : t -> int = "%identity"
include Make ( struct type t = int
type data = t
external hash : t -> int = "%identity"
- external uid : t ->
in
t = "%identity"
- let equal : t -> t -> bool = (==)
+ external uid : t ->
Uid.
t = "%identity"
+ external equal : t -> t -> bool = "%eq"
external make : t -> int = "%identity"
external node : t -> int = "%identity"
external make : t -> int = "%identity"
external node : t -> int = "%identity"