Skip to content

Commit 318c25a

Browse files
committed
Replace inefficient set exists with mem
1 parent 4956c36 commit 318c25a

3 files changed

Lines changed: 3 additions & 4 deletions

File tree

src/analyses/extractPthread.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ module Tbls = struct
168168
let get_fun_for_tid v =
169169
table
170170
|> Hashtbl.to_seq
171-
|> Seq.find_map (fun (k,v') -> if Set.exists (( = ) v) v' then Some k else None)
171+
|> Seq.find_map (fun (k,v') -> if Set.mem v v' then Some k else None)
172172
end
173173

174174
module MutexMidTbl = SymTbl (struct

src/cdomain/value/cdomains/int/enumsDomain.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ module Enums : S with type int_t = Z.t = struct
340340
| Exc (e,_) when BISet.is_empty e -> None
341341
| Inc zero when BISet.is_singleton zero && BISet.choose zero = Z.zero -> Some false
342342
| Inc xs when not (BISet.mem Z.zero xs) -> Some true
343-
| Exc (xs,_) when BISet.exists ((=) Z.zero) xs -> Some true
343+
| Exc (xs,_) when BISet.mem Z.zero xs -> Some true
344344
| _ -> None
345345
let to_int = function Inc x when BISet.is_singleton x -> Some (BISet.choose x) | _ -> None
346346

src/cdomains/regionDomain.ml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ struct
3636
let kill x (y:t): t = lift (VF.kill x) y
3737
let replace x exp y = lift (VF.replace x exp) y
3838

39-
let is_bullet x = x = `Right ()
4039
let bullet = `Right ()
4140
let of_vf vf = `Left vf
4241
let real_region (x:t): bool = match x with
@@ -50,7 +49,7 @@ module RS = struct
5049
let single_vf vf = singleton (VFB.of_vf vf)
5150
let single_bullet = singleton (VFB.bullet)
5251
let remove_bullet x = remove VFB.bullet x
53-
let has_bullet x = exists VFB.is_bullet x
52+
let has_bullet x = mem VFB.bullet x
5453
let is_single_bullet rs =
5554
not (is_top rs) &&
5655
cardinal rs = 1 &&

0 commit comments

Comments
 (0)