diff options
Diffstat (limited to 'lib/sanitizer_common/sanitizer_bvgraph.h')
-rw-r--r-- | lib/sanitizer_common/sanitizer_bvgraph.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/sanitizer_common/sanitizer_bvgraph.h b/lib/sanitizer_common/sanitizer_bvgraph.h index c54955a5a..157b9320e 100644 --- a/lib/sanitizer_common/sanitizer_bvgraph.h +++ b/lib/sanitizer_common/sanitizer_bvgraph.h @@ -129,6 +129,15 @@ class BVGraph { return 0; } + // Same as findPath, but finds a shortest path. + uptr findShortestPath(uptr from, const BV &targets, uptr *path, + uptr path_size) { + for (uptr p = 1; p <= path_size; p++) + if (findPath(from, targets, path, p) == p) + return p; + return 0; + } + private: void check(uptr idx1, uptr idx2) const { CHECK_LT(idx1, size()); |