From 4bcb26ab965bcd3c75836f9b4dec8aea8dabc0d4 Mon Sep 17 00:00:00 2001 From: dehnert Date: Fri, 8 Mar 2013 16:33:52 +0100 Subject: [PATCH] Included subset-test in bitvector. --- src/storage/BitVector.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/storage/BitVector.h b/src/storage/BitVector.h index 801ec2bb2..e6d0add3e 100644 --- a/src/storage/BitVector.h +++ b/src/storage/BitVector.h @@ -392,6 +392,23 @@ public: return result; } + /*! + * Checks whether all bits that are set in the current bit vector are also set in the given bit + * vector. + * @param bv A reference to the bit vector whose bits are (possibly) a superset of the bits of + * the current bit vector. + * @returns True iff all bits that are set in the current bit vector are also set in the given bit + * vector. + */ + bool isContainedIn(BitVector const& bv) const { + for (uint_fast64_t i = 0; i < this->bucketCount; ++i) { + if ((this->bucketArray[i] & bv.bucketArray[i]) != bv.bucketArray[i]) { + return false; + } + } + return true; + } + /*! * Adds all indices of bits set to one to the provided list. * @param list The list to which to append the indices.