From d25367ec4f869aac80e97964fa5d7143536818b1 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 28 Nov 2014 14:16:24 -0500 Subject: 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 --- src/include/nodes/bitmapset.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/include/nodes') 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: */ -- cgit v1.2.3