summaryrefslogtreecommitdiff
path: root/src/include/nodes
diff options
context:
space:
mode:
authorTom Lane2014-11-28 19:16:24 +0000
committerTom Lane2014-11-28 19:16:24 +0000
commitd25367ec4f869aac80e97964fa5d7143536818b1 (patch)
treedbcc0102cdde5c0147622c3ff317444b0c711b3a /src/include/nodes
parentf4e031c662a6b600b786c4849968a099c58fcce7 (diff)
Add bms_get_singleton_member(), and use it where appropriate.
This patch adds a function that replaces a bms_membership() test followed by a bms_singleton_member() call, performing both the test and the extraction of a singleton set's member in one scan of the bitmapset. The performance advantage over the old way is probably minimal in current usage, but it seems worthwhile on notational grounds anyway. David Rowley
Diffstat (limited to 'src/include/nodes')
-rw-r--r--src/include/nodes/bitmapset.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/include/nodes/bitmapset.h b/src/include/nodes/bitmapset.h
index a78ff4886d6..a314192b71a 100644
--- a/src/include/nodes/bitmapset.h
+++ b/src/include/nodes/bitmapset.h
@@ -72,6 +72,7 @@ extern bool bms_is_member(int x, const Bitmapset *a);
extern bool bms_overlap(const Bitmapset *a, const Bitmapset *b);
extern bool bms_nonempty_difference(const Bitmapset *a, const Bitmapset *b);
extern int bms_singleton_member(const Bitmapset *a);
+extern bool bms_get_singleton_member(const Bitmapset *a, int *member);
extern int bms_num_members(const Bitmapset *a);
/* optimized tests when we don't need to know exact membership count: */