ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-3.0/src/utils/BitSet.cpp
(Generate patch)

Comparing trunk/OOPSE-3.0/src/utils/BitSet.cpp (file contents):
Revision 2036 by tim, Tue Feb 15 17:11:35 2005 UTC vs.
Revision 2037 by tim, Wed Feb 16 19:36:30 2005 UTC

# Line 88 | Line 88 | int BitSet::nextOffBit(int fromIndex) const {
88   }
89      
90   int BitSet::nextOffBit(int fromIndex) const {
91 +    if (fromIndex <= -1) {
92 +        //in case -1 or other negative number is passed to this function
93 +        return -1;
94 +    }
95 +    
96      ++fromIndex;
97      while (fromIndex < size()) {
98          if (!bitset_[fromIndex]) {
# Line 100 | Line 105 | int BitSet::nextOnBit(int fromIndex) const {
105   }
106  
107   int BitSet::nextOnBit(int fromIndex) const {
108 +    if (fromIndex <= -1) {
109 +        //in case -1 or other negative number is passed to this function
110 +        return -1;
111 +    }
112 +
113      ++fromIndex;
114      while (fromIndex < size()) {
115          if (bitset_[fromIndex]) {
# Line 168 | Line 178 | bool operator== (const BitSet & bs1, const BitSet &bs2
178      return result;
179   }
180  
181 + BitSet operator- (const BitSet& bs1, const BitSet& bs2) {
182 +    assert(bs1.size() == bs2.size());
183 +
184 +    BitSet result(bs1);
185 +    result -= bs2;
186 +    return result;
187 + }
188 +
189   bool operator== (const BitSet & bs1, const BitSet &bs2) {
190      assert(bs1.size() == bs2.size());
191      return std::equal(bs1.bitset_.begin(), bs1.bitset_.end(), bs2.bitset_.begin());

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines