// union lsDest with lsSrc and place contents in lsDest // NB: this function allocates memory, sometimes, when calling bitset_union static SB_INLINE void labelset_collect(LabelSet *lsDest, LabelSet *lsSrc) { if (lsDest == NULL || lsSrc == NULL) { return; } bitset_collect(*(lsDest->set),*(lsSrc->set)); lsDest->type = 1+max(lsDest->type, lsSrc->type); assert (lsDest->type != LST_DUNNO); assert (lsSrc->type != LST_DUNNO); }
// return a new bitset containing the union of bs1 and bs2 static SB_INLINE BitSet bitset_union(BitSet& bs1, BitSet& bs2) { BitSet bs_new; bitset_collect(bs_new, bs1); bitset_collect(bs_new, bs2); return bs_new; }
// return a new bitset containing the union of bs1 and bs2 static SB_INLINE BitSet* bitset_union(BitSet& bs1, BitSet& bs2) { BitSet *bs_new = new BitSet(); bitset_collect(*bs_new, bs1); bitset_collect(*bs_new, bs2); return bs_new; }