117 bool operator< (const BitSetBase<1>& b)
const {
return d_bits < b.d_bits; }
119 bool any()
const {
return d_bits!=0; }
120 bool none()
const {
return d_bits==0; }
123 {
return (d_bits & b.
d_bits)!=0; }
125 {
return (~d_bits & b.
d_bits)==0; }
133 bool test(
unsigned int j)
const 143 unsigned long to_ulong(
unsigned int n)
const {
return n==0 ? d_bits : 0; }
145 iterator begin()
const;
156 void operator<<= (
unsigned int c)
163 void operator>>= (
unsigned int c)
230 d_bits1 = b.to_ulong(1);
240 bool operator< (const BitSetBase<2>& b)
const 241 {
return d_bits1==b.d_bits1 ? d_bits0<b.d_bits0 : d_bits1<b.d_bits1; }
243 bool any()
const {
return d_bits0!=0
or d_bits1!=0; }
244 bool none()
const {
return d_bits0==0 and d_bits1==0; }
249 {
return (b.
d_bits0 & ~d_bits0)==0 and (b.
d_bits1 & ~d_bits1)==0; }
255 bool test(
unsigned int j)
const;
256 unsigned int position(
unsigned int j)
const;
261 {
return n==0 ? d_bits0 : n==1 ? d_bits1 : 0; }
263 iterator begin()
const;
270 void operator<<= (
unsigned int c);
271 void operator>>= (
unsigned int c);
273 void flip(
unsigned int j);
275 void reset() { d_bits0 = 0ul; d_bits1 = 0ul; }
276 void reset(
unsigned int j) ;
277 void set(
unsigned int j);
278 void fill(
unsigned int limit);
280 void complement(
unsigned int limit);
281 void truncate(
unsigned int limit);
321 template<
size_t n>
class BitSet 344 explicit BitSet(
unsigned long b) : Base(b) {}
347 explicit BitSet(
const std::vector<I>&
v);
354 #if 0 // these are now publicly inherited methods 357 bool operator< (
const BitSet& b)
const {
return Base::operator< (b); }
359 bool any()
const {
return Base::any(); }
360 bool none()
const {
return Base::none(); }
362 bool any(
const BitSet& b)
const {
return Base::any(b); }
363 bool contains(
const BitSet& b)
const {
return Base::contains(b); }
365 unsigned int count()
const {
return Base::count(); }
372 unsigned int position(
unsigned int j)
const {
return Base::position(j); }
374 bool scalarProduct(
const BitSet& b)
const {
return Base::scalarProduct(b); }
376 unsigned long to_ulong()
const {
return Base::to_ulong(); }
377 unsigned long to_ulong(
unsigned int i)
const {
return Base::to_ulong(i); }
385 BitSet& operator^= (
const BitSet& b) { Base::operator^=(b);
return *
this; }
386 BitSet& operator|= (
const BitSet& b) { Base::operator|=(b);
return *
this; }
387 BitSet& operator&= (
const BitSet& b) { Base::operator&=(b);
return *
this; }
389 BitSet& operator<<= (
unsigned int c) { Base::operator<<=(c);
return *
this; }
390 BitSet& operator>>= (
unsigned int c) { Base::operator>>=(c);
return *
this; }
393 BitSet&
flip(
unsigned int j) { Base::flip(j);
return *
this; }
397 BitSet&
set(
unsigned int j) { Base::set(j);
return *
this; }
399 {
if (b) Base::set(j);
else Base::reset(j);
return *
this; }
402 { Base::complement(limit);
return *
this; }
412 bool operator[] (
unsigned int j)
const {
return Base::test(j); }
416 {
BitSet t(*
this);
return t&=b; }
418 {
BitSet t(*
this);
return t|=b; }
420 {
BitSet t(*
this);
return t^=b; }
425 bool dot(
BitSet b)
const {
return Base::scalarProduct(b); }
433 :
public std::iterator<std::input_iterator_tag,unsigned int>
447 bool operator() ()
const {
return d_bits!=0; }
450 iterator& operator++ () { d_bits &= d_bits-1;
return *
this; }
451 iterator operator++ (
int) { iterator tmp(*
this); ++(*this);
return tmp; }
455 :
public std::iterator<std::input_iterator_tag,unsigned int>
464 : d_bits0(b.to_ulong()), d_bits1(b.to_ulong(1)) {}
470 bool operator() ()
const {
return d_bits0!=0
or d_bits1!=0; }
473 iterator& operator++ ();
474 iterator operator++ (
int) { iterator tmp(*
this); ++(*this);
return tmp; }
bool any() const
Definition: bitset.h:119
Definition: parse_types.h:142
unsigned int firstBit() const
Definition: bitset.h:128
BitSet & complement(unsigned int limit)
Definition: bitset.h:401
bool operator!=(const BitSetBase< 2 > &b) const
Definition: bitset.h:238
iterator begin() const
Definition: bitset.h:380
BitSet & reset(unsigned int j)
Definition: bitset.h:396
bool operator!=(const type_expr &x, const type_expr &y)
Definition: axis-types.h:374
unsigned long d_bits0
Definition: bitset.h:196
void truncate(unsigned int limit)
Definition: bitset.h:178
BitSet(unsigned long b)
Definition: bitset.h:344
static const unsigned long posBits
Definition: constants.h:44
PID_Matrix< C > operator-(PID_Matrix< C > A, C c)
Definition: matrix.h:51
unsigned int count() const
Definition: bitset.h:251
bool operator!=(const BitSetBase< 1 > &b) const
Definition: bitset.h:116
iterator()
Definition: bitset.h:462
void test(std::vector< ulong > &moduli, std::vector< ChineseBox * > &box)
Definition: coef-merge.cpp:450
bool any(const BitSetBase< 1 > &b) const
Definition: bitset.h:122
static const unsigned longBits
Definition: constants.h:40
iterator(const typename Base::iterator &b)
Definition: bitset.h:337
value_base * value
Definition: axis-types.h:129
unsigned long d_bits
Definition: bitset.h:435
iterator()
Definition: bitset.h:336
bool dot(BitSet b) const
Definition: bitset.h:425
unsigned int count() const
Definition: bitset.h:127
Set of n bits.
Definition: Atlas.h:57
static unsigned long lMask[longBits+1]
Definition: constants.h:52
iterator const_iterator
Definition: bitset.h:340
void swap(simple_list< T, Alloc > &x, simple_list< T, Alloc > &y)
Definition: sl_list.h:674
size_t lastBit(unsigned long f)
Definition: bits.cpp:89
BitSet & truncate(unsigned int m)
Definition: bitset.h:403
char * limit
Definition: common.c:91
The class BaseSize computes (with its member 'value') the base size.
Definition: bitset.h:299
bool none() const
Definition: bitset.h:244
BitSet & fill(unsigned int limit)
Definition: bitset.h:400
unsigned int position(unsigned int j) const
Definition: bitset.h:136
iterator()
Definition: bitset.h:440
void flip(unsigned int j)
Definition: bitset.h:171
void andnot(const BitSetBase< 1 > &b)
Definition: bitset.h:153
unsigned long d_bits1
Definition: bitset.h:196
bool operator==(const BitSetBase< 1 > &b) const
Definition: bitset.h:115
void complement(unsigned int limit)
Definition: bitset.h:177
unsigned long to_ulong(unsigned int n) const
Definition: bitset.h:143
unsigned int bitCount(unsigned long x)
Definition: bits.cpp:30
Base for a non-empty BitSet that fits in two words but not one.
Definition: bitset.h:194
BitSet & reset()
Definition: bitset.h:395
void swap(BitSetBase< 1 > &source)
Definition: bitset.h:183
unsigned int value_type
Definition: bitset.h:334
RationalVector< C2 > operator*(const matrix::Matrix< C1 > &M, const RationalVector< C2 > &v)
Definition: ratvec.cpp:158
void fill(unsigned int limit)
Definition: bitset.h:175
unsigned long to_ulong() const
Definition: bitset.h:142
void reset()
Definition: bitset.h:172
bool scalarProduct(const BitSetBase< 1 > &b) const
Definition: bitset.h:139
bool operator==(const BitSetBase< 2 > &b) const
Definition: bitset.h:236
void reset(unsigned int j)
Definition: bitset.h:173
iterator(const BitSetBase< 1 > &b)
Definition: bitset.h:441
unsigned long d_bits1
Definition: bitset.h:457
unsigned long d_bits
Word that holds the BitSet.
Definition: bitset.h:94
Type definitions for the class BitSet.
BitSet & slice(const BitSet &c)
Definition: bitset.h:405
Definition: constants.h:35
BitSet(const BitSet< m > &b)
Copy from other size BitSets, only to be used with |m<n|.
Definition: bitset.h:350
bool test(unsigned int j) const
Definition: bitset.h:133
void reset()
Definition: bitset.h:275
iterator end() const
Definition: bitset.h:381
BitSet & andnot(const BitSet &b)
Definition: bitset.h:392
unsigned long to_ulong(unsigned int n) const
Definition: bitset.h:260
size_t firstBit(unsigned long f)
Definition: bits.cpp:64
static unsigned long bitMask[longBits]
Definition: constants.h:48
bool none() const
Definition: bitset.h:120
unsigned long n
Definition: axis.cpp:77
bool operator==(const type_expr &x, const type_expr &y)
Definition: axis-types.cpp:257
Base for a non-empty BitSet that fits in one word.
Definition: bitset.h:89
BitSet & flip(unsigned int j)
Definition: bitset.h:393
void swap(BitSet &source)
Definition: bitset.h:408
unsigned long to_ulong() const
Definition: bitset.h:259
iterator(const BitSetBase< 2 > &b)
Definition: bitset.h:463
bool contains(const BitSetBase< 1 > &b) const
Definition: bitset.h:124
unsigned int lastBit() const
Definition: bitset.h:130
bool any() const
Definition: bitset.h:243
BitSetBase< BaseSize< n >::value > Base
Definition: bitset.h:324
bool contains(const BitSetBase< 2 > &b) const
Definition: bitset.h:248
BitSet & unslice(const BitSet &c)
Definition: bitset.h:406
BitSet()
Definition: bitset.h:343
bool any(const BitSetBase< 2 > &b) const
Definition: bitset.h:246
std::forward_iterator_tag iterator_category
Definition: bitset.h:333
Vertex v
Definition: graph.cpp:116