diff --git a/src/patricia.ml b/src/patricia.ml index 4a18ab17aaeaaad546a1d6a26399835cfa7db253..3eaa625b5f5174ee829000aa80483b720e712ee3 100644 --- a/src/patricia.ml +++ b/src/patricia.ml @@ -372,7 +372,7 @@ module Make (X : Endianness.S) = struct fine_add decide key value s | Branch(p, m, s0, s1), Branch(q, n, t0, t1) -> - if (p = q) & (m = n) then + if (p = q) && (m = n) then (* The trees have the same prefix. Merge their sub-trees. *) @@ -381,7 +381,7 @@ module Make (X : Endianness.S) = struct if t0 == u0 && t1 == u1 then t else Branch(p, m, u0, u1) - else if (X.shorter m n) & (match_prefix q p m) then + else if (X.shorter m n) && (match_prefix q p m) then (* [q] contains [p]. Merge [t] with a sub-tree of [s]. *) @@ -390,7 +390,7 @@ module Make (X : Endianness.S) = struct else Branch(p, m, s0, union s1 t) - else if (X.shorter n m) & (match_prefix p q n) then + else if (X.shorter n m) && (match_prefix p q n) then (* [p] contains [q]. Merge [s] with a sub-tree of [t]. *) @@ -500,7 +500,7 @@ module Make (X : Endianness.S) = struct | Branch (p, m, tree0, tree1) -> let tree0' = endo_map f tree0 in let tree1' = endo_map f tree1 in - if (tree0' == tree0) & (tree1' == tree1) then + if (tree0' == tree0) && (tree1' == tree1) then tree else Branch (p, m, tree0', tree1') @@ -730,7 +730,7 @@ module Domain = struct add x s | Branch(p, m, s0, s1), Branch(q, n, t0, t1) -> - if (p = q) & (m = n) then + if (p = q) && (m = n) then (* The trees have the same prefix. Merge their sub-trees. *) @@ -739,7 +739,7 @@ module Domain = struct if t0 == u0 && t1 == u1 then t else Branch(p, m, u0, u1) - else if (X.shorter m n) & (match_prefix q p m) then + else if (X.shorter m n) && (match_prefix q p m) then (* [q] contains [p]. Merge [t] with a sub-tree of [s]. *) @@ -748,7 +748,7 @@ module Domain = struct else Branch(p, m, s0, union s1 t) - else if (X.shorter n m) & (match_prefix p q n) then + else if (X.shorter n m) && (match_prefix p q n) then (* [p] contains [q]. Merge [s] with a sub-tree of [t]. *) @@ -801,13 +801,13 @@ module Domain = struct remove x s | Branch(p, m, s0, s1), Branch(q, n, t0, t1) -> - if (p = q) & (m = n) then + if (p = q) && (m = n) then (* The trees have the same prefix. Compute the differences of their sub-trees. *) build p m (diff s0 t0) (diff s1 t1) - else if (X.shorter m n) & (match_prefix q p m) then + else if (X.shorter m n) && (match_prefix q p m) then (* [q] contains [p]. Subtract [t] off a sub-tree of [s]. *) @@ -816,7 +816,7 @@ module Domain = struct else build p m s0 (diff s1 t) - else if (X.shorter n m) & (match_prefix p q n) then + else if (X.shorter n m) && (match_prefix p q n) then (* [p] contains [q]. Subtract a sub-tree of [t] off [s]. *) @@ -842,19 +842,19 @@ module Domain = struct if mem x t then s else Empty | Branch(p, m, s0, s1), Branch(q, n, t0, t1) -> - if (p = q) & (m = n) then + if (p = q) && (m = n) then (* The trees have the same prefix. Compute the intersections of their sub-trees. *) build p m (inter s0 t0) (inter s1 t1) - else if (X.shorter m n) & (match_prefix q p m) then + else if (X.shorter m n) && (match_prefix q p m) then (* [q] contains [p]. Intersect [t] with a sub-tree of [s]. *) inter (if (q land m) = 0 then s0 else s1) t - else if (X.shorter n m) & (match_prefix p q n) then + else if (X.shorter n m) && (match_prefix p q n) then (* [p] contains [q]. Intersect [s] with a sub-tree of [t]. *) @@ -888,13 +888,13 @@ module Domain = struct raise NotDisjoint | Branch(p, m, s0, s1), Branch(q, n, t0, t1) -> - if (p = q) & (m = n) then begin + if (p = q) && (m = n) then begin inter s0 t0; inter s1 t1 end - else if (X.shorter m n) & (match_prefix q p m) then + else if (X.shorter m n) && (match_prefix q p m) then inter (if (q land m) = 0 then s0 else s1) t - else if (X.shorter n m) & (match_prefix p q n) then + else if (X.shorter n m) && (match_prefix p q n) then inter s (if (p land n) = 0 then t0 else t1) else () in @@ -1045,13 +1045,13 @@ module Domain = struct | Branch(p, m, s0, s1), Branch(q, n, t0, t1) -> - if (p = q) & (m = n) then begin + if (p = q) && (m = n) then begin diff s0 t0; diff s1 t1 end - else if (X.shorter n m) & (match_prefix p q n) then + else if (X.shorter n m) && (match_prefix p q n) then diff s (if (p land n) = 0 then t0 else t1) @@ -1160,18 +1160,18 @@ end remove k s | Branch(p, m, s0, s1), Domain.Branch(q, n, t0, t1) -> - if (p = q) & (m = n) then + if (p = q) && (m = n) then build p m (corestrict s0 t0) (corestrict s1 t1) - else if (X.shorter m n) & (match_prefix q p m) then + else if (X.shorter m n) && (match_prefix q p m) then if (q land m) = 0 then build p m (corestrict s0 t) s1 else build p m s0 (corestrict s1 t) - else if (X.shorter n m) & (match_prefix p q n) then + else if (X.shorter n m) && (match_prefix p q n) then corestrict s (if (p land n) = 0 then t0 else t1)