CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Public Member Functions | Private Attributes | Friends
DTTFBitArray< N > Class Template Reference

#include <DTTFBitArray.h>

Classes

class  refToBit
 

Public Member Functions

int any ()
 
void assign (const int p, const int n, const char *str)
 
void assign (const int p, const int n, const DTTFBitArray< N > &val)
 
void assign (const int p, const int n, const int val)
 
DTTFBitArray< 8 > byte (const int i) const
 
void cleanUnused ()
 
int count () const
 
unsigned & dataWord (const int i)
 
unsigned dataWord (const int i) const
 
 DTTFBitArray ()
 
 DTTFBitArray (const char *str)
 
 DTTFBitArray (const char *str, const int p, const int n)
 
 DTTFBitArray (const DTTFBitArray< N > &br)
 
 DTTFBitArray (const unsigned i)
 
int element (const int pos) const
 
DTTFBitArray< N > & flip ()
 
unsigned & getWord (const int pos)
 
unsigned getWord (const int pos) const
 
unsigned lastWordMask () const
 
int nBits () const
 
int none ()
 
int nWords () const
 
void one ()
 
bool operator!= (const DTTFBitArray< N > &a) const
 
DTTFBitArray< Noperator& (const DTTFBitArray< N > &a)
 
DTTFBitArray< N > & operator&= (const DTTFBitArray< N > &a)
 
DTTFBitArray< Noperator+ (const DTTFBitArray< N > &a)
 
DTTFBitArray< N > & operator++ (int)
 
DTTFBitArray< N > & operator+= (const DTTFBitArray< N > &a)
 
DTTFBitArray< Noperator- (const DTTFBitArray< N > &a)
 
DTTFBitArray< N > & operator-= (const DTTFBitArray< N > &a)
 
bool operator< (const DTTFBitArray< N > &a) const
 
DTTFBitArray< Noperator<< (const int n)
 
DTTFBitArray< N > & operator<<= (const int n)
 
bool operator<= (const DTTFBitArray< N > &a) const
 
DTTFBitArray< N > & operator= (const char *str)
 
DTTFBitArray< N > & operator= (const DTTFBitArray< N > &a)
 
DTTFBitArray< N > & operator= (const unsigned i)
 
bool operator== (const DTTFBitArray< N > &a) const
 
bool operator> (const DTTFBitArray< N > &a) const
 
bool operator>= (const DTTFBitArray< N > &a) const
 
DTTFBitArray< Noperator>> (const int n)
 
DTTFBitArray< N > & operator>>= (const int n)
 
refToBit operator[] (const int pos)
 
int operator[] (const int pos) const
 
DTTFBitArray< Noperator^ (const DTTFBitArray< N > &a)
 
DTTFBitArray< N > & operator^= (const DTTFBitArray< N > &a)
 
DTTFBitArray< Noperator| (const DTTFBitArray< N > &a)
 
DTTFBitArray< N > & operator|= (const DTTFBitArray< N > &a)
 
DTTFBitArray< Noperator~ () const
 
std::ostream & print (std::ostream &o=std::cout) const
 
unsigned read (const int p, const int n) const
 
void reset ()
 
void reset (const int i)
 
void set (const int i)
 
void set (const int i, const char *str)
 
void set (const int i, const int val)
 
int size () const
 
int test (const int i) const
 
DTTFBitArray< N > & twoComplement ()
 
DTTFBitArray< NtwoComplement () const
 
void unset (const int i)
 
int unusedBits () const
 
void zero ()
 

Static Public Member Functions

static int getPosInWord (const int pos)
 
static unsigned getPosMask (const int pos)
 

Private Attributes

unsigned _data [N/32+1]
 

Friends

class refToBit
 

Detailed Description

template<int N>
class DTTFBitArray< N >

Definition at line 28 of file DTTFBitArray.h.

Constructor & Destructor Documentation

◆ DTTFBitArray() [1/5]

template<int N>
DTTFBitArray< N >::DTTFBitArray ( )
inline

Definition at line 79 of file DTTFBitArray.h.

79 { this->zero(); }

References DTTFBitArray< N >::zero().

◆ DTTFBitArray() [2/5]

template<int N>
DTTFBitArray< N >::DTTFBitArray ( const DTTFBitArray< N > &  br)
inline

Definition at line 81 of file DTTFBitArray.h.

81  {
82  for (int i = 0; i < this->nWords(); i++) {
83  _data[i] = br._data[i];
84  }
85  this->cleanUnused();
86  }

References DTTFBitArray< N >::_data, DTTFBitArray< N >::cleanUnused(), mps_fire::i, and DTTFBitArray< N >::nWords().

◆ DTTFBitArray() [3/5]

template<int N>
DTTFBitArray< N >::DTTFBitArray ( const char *  str)
inline

Definition at line 87 of file DTTFBitArray.h.

87  {
88  this->zero();
89  this->assign(0, this->nBits(), str);
90  this->cleanUnused();
91  }

References DTTFBitArray< N >::assign(), DTTFBitArray< N >::cleanUnused(), DTTFBitArray< N >::nBits(), and DTTFBitArray< N >::zero().

◆ DTTFBitArray() [4/5]

template<int N>
DTTFBitArray< N >::DTTFBitArray ( const char *  str,
const int  p,
const int  n 
)
inline

Definition at line 92 of file DTTFBitArray.h.

92  {
93  this->zero();
94  this->assign(p, n, str);
95  }

References DTTFBitArray< N >::assign(), dqmiodumpmetadata::n, str, and DTTFBitArray< N >::zero().

◆ DTTFBitArray() [5/5]

template<int N>
DTTFBitArray< N >::DTTFBitArray ( const unsigned  i)
inline

Definition at line 96 of file DTTFBitArray.h.

96  {
97  this->zero();
98  _data[0] = i; // the nBit least sign. bits are considered
99  this->cleanUnused();
100  }

References DTTFBitArray< N >::_data, DTTFBitArray< N >::cleanUnused(), mps_fire::i, and DTTFBitArray< N >::zero().

Member Function Documentation

◆ any()

template<int N>
int DTTFBitArray< N >::any ( )
inline

Definition at line 176 of file DTTFBitArray.h.

176  {
177  int nw = this->nWords();
178  int ub = unusedBits();
179  if (this->dataWord(nw - 1) << ub != 0)
180  return 1;
181  if (nw > 1) {
182  for (int iw = 0; iw < nw - 1; iw++) {
183  if (this->dataWord(iw) != 0)
184  return 1;
185  }
186  }
187  return 0;
188  }

References DTTFBitArray< N >::dataWord(), DTTFBitArray< N >::nWords(), and DTTFBitArray< N >::unusedBits().

◆ assign() [1/3]

template<int N>
void DTTFBitArray< N >::assign ( const int  p,
const int  n,
const char *  str 
)
inline

Definition at line 255 of file DTTFBitArray.h.

255  {
256  assert(p >= 0 && p + n <= this->nBits());
257  // only the n least significant bits of val are considered
258  for (int i = 0; i < n; i++) {
259  assert(str[i] == '1' || str[i] == '0');
260  if (str[i] == '1') {
261  this->set(p + n - i - 1); // reading a string from left to right
262  } else { // --> most significative bit is the one
263  this->unset(p + n - i - 1); // with lower string index
264  }
265  }
266  }

References cms::cuda::assert(), mps_fire::i, dqmiodumpmetadata::n, DTTFBitArray< N >::nBits(), AlCaHLTBitMon_ParallelJobs::p, DTTFBitArray< N >::set(), str, and DTTFBitArray< N >::unset().

◆ assign() [2/3]

template<int N>
void DTTFBitArray< N >::assign ( const int  p,
const int  n,
const DTTFBitArray< N > &  val 
)
inline

Definition at line 244 of file DTTFBitArray.h.

244  {
245  assert(p >= 0 && p + n <= this->nBits());
246  // only the n least significant bits of val are considered
247  for (int i = 0; i < n; i++) {
248  if (val.element(i)) {
249  this->set(p + i);
250  } else {
251  this->unset(p + i);
252  }
253  }
254  }

References cms::cuda::assert(), mps_fire::i, dqmiodumpmetadata::n, DTTFBitArray< N >::nBits(), AlCaHLTBitMon_ParallelJobs::p, DTTFBitArray< N >::set(), DTTFBitArray< N >::unset(), and heppy_batch::val.

◆ assign() [3/3]

template<int N>
void DTTFBitArray< N >::assign ( const int  p,
const int  n,
const int  val 
)
inline

Definition at line 233 of file DTTFBitArray.h.

233  {
234  assert(p >= 0 && p + n <= this->nBits());
235  // only the n least significant bits of val are considered
236  for (int i = 0; i < n; i++) {
237  if (val >> i & 1) {
238  this->set(p + i);
239  } else {
240  this->unset(p + i);
241  }
242  }
243  }

References cms::cuda::assert(), mps_fire::i, dqmiodumpmetadata::n, DTTFBitArray< N >::nBits(), AlCaHLTBitMon_ParallelJobs::p, DTTFBitArray< N >::set(), DTTFBitArray< N >::unset(), and heppy_batch::val.

Referenced by DTTFBitArray< N >::DTTFBitArray(), and DTTFBitArray< N >::set().

◆ byte()

template<int N>
DTTFBitArray<8> DTTFBitArray< N >::byte ( const int  i) const
inline

Definition at line 282 of file DTTFBitArray.h.

282  {
284  if (i >= 0 && i < 4 * this->nWords()) {
285  unsigned k = (_data[i / 4] >> 8 * (i % 4)) & 0xff;
286  out = k;
287  }
288  return out;
289  }

References DTTFBitArray< N >::_data, mps_fire::i, dqmdumpme::k, DTTFBitArray< N >::nWords(), and MillePedeFileConverter_cfg::out.

◆ cleanUnused()

template<int N>
void DTTFBitArray< N >::cleanUnused ( )
inline

◆ count()

template<int N>
int DTTFBitArray< N >::count ( void  ) const
inline

Definition at line 166 of file DTTFBitArray.h.

166  {
167  int n = 0;
168  for (int i = 0; i < this->nBits(); i++) {
169  if (this->element(i))
170  n++;
171  }
172  return n;
173  }

References DTTFBitArray< N >::element(), mps_fire::i, dqmiodumpmetadata::n, and DTTFBitArray< N >::nBits().

◆ dataWord() [1/2]

template<int N>
unsigned& DTTFBitArray< N >::dataWord ( const int  i)
inline

Definition at line 128 of file DTTFBitArray.h.

128  {
129  assert(i >= 0 && i < this->nWords());
130  return _data[i];
131  }

References DTTFBitArray< N >::_data, cms::cuda::assert(), mps_fire::i, and DTTFBitArray< N >::nWords().

◆ dataWord() [2/2]

template<int N>
unsigned DTTFBitArray< N >::dataWord ( const int  i) const
inline

◆ element()

template<int N>
int DTTFBitArray< N >::element ( const int  pos) const
inline

◆ flip()

template<int N>
DTTFBitArray<N>& DTTFBitArray< N >::flip ( )
inline

Definition at line 403 of file DTTFBitArray.h.

403  {
404  for (int i = 0; i < this->nWords(); i++) {
405  _data[i] = ~_data[i];
406  }
407  return *this;
408  }

References DTTFBitArray< N >::_data, mps_fire::i, and DTTFBitArray< N >::nWords().

Referenced by DTTFBitArray< N >::operator~().

◆ getPosInWord()

template<int N>
static int DTTFBitArray< N >::getPosInWord ( const int  pos)
inlinestatic

Definition at line 144 of file DTTFBitArray.h.

144  {
145  // assert(pos>=0&& pos<this->nBits());
146  return pos % 32;
147  }

Referenced by DTTFBitArray< N >::getPosMask(), and DTTFBitArray< N >::refToBit::refToBit().

◆ getPosMask()

template<int N>
static unsigned DTTFBitArray< N >::getPosMask ( const int  pos)
inlinestatic

◆ getWord() [1/2]

template<int N>
unsigned& DTTFBitArray< N >::getWord ( const int  pos)
inline

Definition at line 134 of file DTTFBitArray.h.

134  {
135  assert(pos >= 0 && pos < this->nBits());
136  return _data[pos / 32];
137  }

References DTTFBitArray< N >::_data, cms::cuda::assert(), and DTTFBitArray< N >::nBits().

Referenced by DTTFBitArray< N >::element(), DTTFBitArray< N >::set(), and DTTFBitArray< N >::unset().

◆ getWord() [2/2]

template<int N>
unsigned DTTFBitArray< N >::getWord ( const int  pos) const
inline

Definition at line 138 of file DTTFBitArray.h.

138  {
139  assert(pos >= 0 && pos < this->nBits());
140  return _data[pos / 32];
141  }

References DTTFBitArray< N >::_data, cms::cuda::assert(), and DTTFBitArray< N >::nBits().

◆ lastWordMask()

template<int N>
unsigned DTTFBitArray< N >::lastWordMask ( ) const
inline

Definition at line 160 of file DTTFBitArray.h.

160 { return static_cast<unsigned>(0xffffffff) >> (this->unusedBits()); }

References DTTFBitArray< N >::unusedBits().

Referenced by DTTFBitArray< N >::cleanUnused().

◆ nBits()

template<int N>
int DTTFBitArray< N >::nBits ( ) const
inline

◆ none()

template<int N>
int DTTFBitArray< N >::none ( )
inline

Definition at line 191 of file DTTFBitArray.h.

191  {
192  int nw = this->nWords();
193  int ub = unusedBits();
194  if (this->dataWord(nw - 1) << ub != 0xffffffff)
195  return 1;
196  if (nw > 1) {
197  for (int iw = 0; iw < nw - 1; iw++) {
198  if (this->dataWord(iw) != 0xffffffff)
199  return 1;
200  }
201  }
202  return 0;
203  }

References DTTFBitArray< N >::dataWord(), DTTFBitArray< N >::nWords(), and DTTFBitArray< N >::unusedBits().

◆ nWords()

template<int N>
int DTTFBitArray< N >::nWords ( ) const
inline

◆ one()

template<int N>
void DTTFBitArray< N >::one ( )
inline

Definition at line 217 of file DTTFBitArray.h.

217  {
218  for (int i = 0; i < this->nWords(); i++) {
219  _data[i] = 0xffffffff; // set to 1
220  }
221  }

References DTTFBitArray< N >::_data, mps_fire::i, and DTTFBitArray< N >::nWords().

Referenced by runEdmFileComparison.EdmObject::label().

◆ operator!=()

template<int N>
bool DTTFBitArray< N >::operator!= ( const DTTFBitArray< N > &  a) const
inline

Definition at line 391 of file DTTFBitArray.h.

391 { return !(a == *this); }

References a.

◆ operator&()

template<int N>
DTTFBitArray<N> DTTFBitArray< N >::operator& ( const DTTFBitArray< N > &  a)
inline

Definition at line 422 of file DTTFBitArray.h.

422 { return DTTFBitArray<N>(*this) &= a; }

References a.

◆ operator&=()

template<int N>
DTTFBitArray<N>& DTTFBitArray< N >::operator&= ( const DTTFBitArray< N > &  a)
inline

Definition at line 414 of file DTTFBitArray.h.

414  {
415  for (int i = 0; i < this->nWords(); i++) {
416  this->dataWord(i) &= a.dataWord(i);
417  }
418  return *this;
419  }

References DTTFBitArray< N >::dataWord(), mps_fire::i, and DTTFBitArray< N >::nWords().

◆ operator+()

template<int N>
DTTFBitArray<N> DTTFBitArray< N >::operator+ ( const DTTFBitArray< N > &  a)
inline

Definition at line 492 of file DTTFBitArray.h.

492 { return DTTFBitArray<N>(*this) += a; }

References a.

◆ operator++()

template<int N>
DTTFBitArray<N>& DTTFBitArray< N >::operator++ ( int  )
inline

Definition at line 495 of file DTTFBitArray.h.

495  {
496  int i = 0;
497  while (i < this->nBits() && this->element(i) == 1) {
498  this->unset(i);
499  i++;
500  }
501  if (i < this->nBits())
502  this->set(i);
503  return *this;
504  }

References DTTFBitArray< N >::element(), mps_fire::i, DTTFBitArray< N >::nBits(), DTTFBitArray< N >::set(), and DTTFBitArray< N >::unset().

◆ operator+=()

template<int N>
DTTFBitArray<N>& DTTFBitArray< N >::operator+= ( const DTTFBitArray< N > &  a)
inline

Definition at line 479 of file DTTFBitArray.h.

479  {
480  int rep = 0;
481  int sum = 0;
482  for (int i = 0; i < this->nBits(); i++) {
483  sum = this->element(i) ^ rep;
484  rep = this->element(i) & rep;
485  this->set(i, sum ^ a.element(i));
486  rep |= (sum & a.element(i));
487  }
488  return *this;
489  }

References a, DTTFBitArray< N >::element(), mps_fire::i, DTTFBitArray< N >::nBits(), cuy::rep, and DTTFBitArray< N >::set().

◆ operator-()

template<int N>
DTTFBitArray<N> DTTFBitArray< N >::operator- ( const DTTFBitArray< N > &  a)
inline

Definition at line 520 of file DTTFBitArray.h.

520 { return DTTFBitArray<N>(*this) -= a; }

References a.

◆ operator-=()

template<int N>
DTTFBitArray<N>& DTTFBitArray< N >::operator-= ( const DTTFBitArray< N > &  a)
inline

Definition at line 517 of file DTTFBitArray.h.

517 { return *this += a.twoComplement(); }

References a.

◆ operator<()

template<int N>
bool DTTFBitArray< N >::operator< ( const DTTFBitArray< N > &  a) const
inline

Definition at line 368 of file DTTFBitArray.h.

368  {
369  int nw = this->nWords();
370  int ub = this->unusedBits();
371  unsigned aaa = this->dataWord(nw - 1) << ub; // ignore unused bits
372  unsigned bbb = a.dataWord(nw - 1) << ub; // in both operands
373  if (aaa < bbb) {
374  return true;
375  } else if (aaa > bbb) {
376  return false;
377  }
378  if (nw > 1) {
379  for (int iw = nw - 2; iw >= 0; iw--) {
380  if (this->dataWord(iw) < a.dataWord(iw)) {
381  return true;
382  } else if (this->dataWord(iw) > a.dataWord(iw)) {
383  return false;
384  }
385  }
386  }
387  return false;
388  }

References a, DTTFBitArray< N >::dataWord(), DTTFBitArray< N >::nWords(), and DTTFBitArray< N >::unusedBits().

◆ operator<<()

template<int N>
DTTFBitArray<N> DTTFBitArray< N >::operator<< ( const int  n)
inline

Definition at line 460 of file DTTFBitArray.h.

460 { return DTTFBitArray<N>(*this) <<= n; }

References dqmiodumpmetadata::n.

◆ operator<<=()

template<int N>
DTTFBitArray<N>& DTTFBitArray< N >::operator<<= ( const int  n)
inline

Definition at line 447 of file DTTFBitArray.h.

447  {
448  assert(n >= 0 && n < this->nBits());
449  if (n == 0)
450  return *this;
451  int i = 0;
452  for (i = this->nBits() - 1; i >= n; i--)
453  this->set(i, this->element(i - n));
454  for (i = n - 1; i >= 0; i--)
455  this->unset(i);
456  return *this;
457  }

References cms::cuda::assert(), DTTFBitArray< N >::element(), mps_fire::i, dqmiodumpmetadata::n, DTTFBitArray< N >::nBits(), DTTFBitArray< N >::set(), and DTTFBitArray< N >::unset().

◆ operator<=()

template<int N>
bool DTTFBitArray< N >::operator<= ( const DTTFBitArray< N > &  a) const
inline

Definition at line 400 of file DTTFBitArray.h.

400 { return !(*this > a); }

References a.

◆ operator=() [1/3]

template<int N>
DTTFBitArray<N>& DTTFBitArray< N >::operator= ( const char *  str)
inline

Definition at line 323 of file DTTFBitArray.h.

323  {
324  this->zero();
325  for (int i = 0; i < this->nBits(); i++) {
326  assert(str[i] == '1' || str[i] == '0');
327  if (str[i] == '1') {
328  this->set(this->nBits() - i - 1); // reading a string from left to right
329  } else if (str[i] == '0') { // --> most significative bit is the one
330  this->unset(this->nBits() - i - 1); // with lower string index
331  } else {
332  break; // exit when find a char which is not 0 or 1
333  }
334  }
335  this->cleanUnused();
336  return *this;
337  }

References cms::cuda::assert(), DTTFBitArray< N >::cleanUnused(), mps_fire::i, DTTFBitArray< N >::nBits(), DTTFBitArray< N >::set(), str, DTTFBitArray< N >::unset(), and DTTFBitArray< N >::zero().

◆ operator=() [2/3]

template<int N>
DTTFBitArray<N>& DTTFBitArray< N >::operator= ( const DTTFBitArray< N > &  a)
inline

Definition at line 291 of file DTTFBitArray.h.

291  {
292  if (this != &a) {
293  for (int i = 0; i < this->nWords(); i++) {
294  _data[i] = a._data[i];
295  }
296  }
297  this->cleanUnused();
298  return *this;
299  }

References DTTFBitArray< N >::_data, a, DTTFBitArray< N >::cleanUnused(), mps_fire::i, and DTTFBitArray< N >::nWords().

◆ operator=() [3/3]

template<int N>
DTTFBitArray<N>& DTTFBitArray< N >::operator= ( const unsigned  i)
inline

Definition at line 302 of file DTTFBitArray.h.

302  {
303  this->zero();
304  _data[0] = i; // the nBit least sign. bits are considered
305  this->cleanUnused();
306  return *this;
307  }

References DTTFBitArray< N >::_data, DTTFBitArray< N >::cleanUnused(), mps_fire::i, and DTTFBitArray< N >::zero().

◆ operator==()

template<int N>
bool DTTFBitArray< N >::operator== ( const DTTFBitArray< N > &  a) const
inline

Definition at line 352 of file DTTFBitArray.h.

352  {
353  int nw = this->nWords();
354  int ub = this->unusedBits();
355  if (this->dataWord(nw - 1) << ub != // check last word
356  a.dataWord(nw - 1) << ub)
357  return false;
358  if (nw > 1) {
359  for (int iw = 0; iw < nw - 1; iw++) {
360  if (this->dataWord(iw) != a.dataWord(iw))
361  return false;
362  }
363  }
364  return true;
365  }

References a, DTTFBitArray< N >::dataWord(), DTTFBitArray< N >::nWords(), and DTTFBitArray< N >::unusedBits().

◆ operator>()

template<int N>
bool DTTFBitArray< N >::operator> ( const DTTFBitArray< N > &  a) const
inline

Definition at line 397 of file DTTFBitArray.h.

397 { return !(*this < a || *this == a); }

References a.

◆ operator>=()

template<int N>
bool DTTFBitArray< N >::operator>= ( const DTTFBitArray< N > &  a) const
inline

Definition at line 394 of file DTTFBitArray.h.

394 { return !(*this < a); }

References a.

◆ operator>>()

template<int N>
DTTFBitArray<N> DTTFBitArray< N >::operator>> ( const int  n)
inline

Definition at line 476 of file DTTFBitArray.h.

476 { return DTTFBitArray<N>(*this) >>= n; }

References dqmiodumpmetadata::n.

◆ operator>>=()

template<int N>
DTTFBitArray<N>& DTTFBitArray< N >::operator>>= ( const int  n)
inline

Definition at line 463 of file DTTFBitArray.h.

463  {
464  assert(n >= 0 && n < this->nBits());
465  if (n == 0)
466  return *this;
467  int i = 0;
468  for (i = 0; i < this->nBits() - n; i++)
469  this->set(i, this->element(i + n));
470  for (i = this->nBits() - n; i < this->nBits(); i++)
471  this->unset(i);
472  return *this;
473  }

References cms::cuda::assert(), DTTFBitArray< N >::element(), mps_fire::i, dqmiodumpmetadata::n, DTTFBitArray< N >::nBits(), DTTFBitArray< N >::set(), and DTTFBitArray< N >::unset().

◆ operator[]() [1/2]

template<int N>
refToBit DTTFBitArray< N >::operator[] ( const int  pos)
inline

Definition at line 348 of file DTTFBitArray.h.

348 { return refToBit(*this, pos); }

References DTTFBitArray< N >::refToBit.

◆ operator[]() [2/2]

template<int N>
int DTTFBitArray< N >::operator[] ( const int  pos) const
inline

Definition at line 349 of file DTTFBitArray.h.

349 { return element(pos); }

References DTTFBitArray< N >::element().

◆ operator^()

template<int N>
DTTFBitArray<N> DTTFBitArray< N >::operator^ ( const DTTFBitArray< N > &  a)
inline

Definition at line 444 of file DTTFBitArray.h.

444 { return DTTFBitArray<N>(*this) ^= a; }

References a.

◆ operator^=()

template<int N>
DTTFBitArray<N>& DTTFBitArray< N >::operator^= ( const DTTFBitArray< N > &  a)
inline

Definition at line 436 of file DTTFBitArray.h.

436  {
437  for (int i = 0; i < this->nWords(); i++) {
438  this->dataWord(i) ^= a.dataWord(i);
439  }
440  return *this;
441  }

References DTTFBitArray< N >::dataWord(), mps_fire::i, and DTTFBitArray< N >::nWords().

◆ operator|()

template<int N>
DTTFBitArray<N> DTTFBitArray< N >::operator| ( const DTTFBitArray< N > &  a)
inline

Definition at line 433 of file DTTFBitArray.h.

433 { return DTTFBitArray<N>(*this) |= a; }

References a.

◆ operator|=()

template<int N>
DTTFBitArray<N>& DTTFBitArray< N >::operator|= ( const DTTFBitArray< N > &  a)
inline

Definition at line 425 of file DTTFBitArray.h.

425  {
426  for (int i = 0; i < this->nWords(); i++) {
427  this->dataWord(i) |= a.dataWord(i);
428  }
429  return *this;
430  }

References DTTFBitArray< N >::dataWord(), mps_fire::i, and DTTFBitArray< N >::nWords().

◆ operator~()

template<int N>
DTTFBitArray<N> DTTFBitArray< N >::operator~ ( ) const
inline

Definition at line 411 of file DTTFBitArray.h.

411 { return DTTFBitArray<N>(*this).flip(); }

References DTTFBitArray< N >::flip().

◆ print()

template<int N>
std::ostream& DTTFBitArray< N >::print ( std::ostream &  o = std::cout) const
inline

Definition at line 340 of file DTTFBitArray.h.

340  {
341  for (int i = this->nBits() - 1; i >= 0; i--) {
342  o << this->element(i);
343  }
344  return o;
345  }

References DTTFBitArray< N >::element(), mps_fire::i, DTTFBitArray< N >::nBits(), and EcalTangentSkim_cfg::o.

Referenced by L1MuDTPtaLut::print(), and L1MuBMLUTHandler::print_pta_lut().

◆ read()

template<int N>
unsigned DTTFBitArray< N >::read ( const int  p,
const int  n 
) const
inline

Definition at line 269 of file DTTFBitArray.h.

269  {
270  assert(p >= 0 && p + n <= this->nBits());
271  assert(n <= 32); // the output must fit in a 32 bit word
272  // only the n least significant bits of val are considered
273  unsigned out = 0x0;
274  for (int i = 0; i < n; i++) {
275  if (this->test(p + i))
276  out |= 1 << i;
277  }
278  return out;
279  }

References cms::cuda::assert(), mps_fire::i, dqmiodumpmetadata::n, DTTFBitArray< N >::nBits(), MillePedeFileConverter_cfg::out, AlCaHLTBitMon_ParallelJobs::p, and DTTFBitArray< N >::test().

Referenced by edmIntegrityCheck.PublishToFileSystem::get().

◆ reset() [1/2]

template<int N>
void DTTFBitArray< N >::reset ( void  )
inline

◆ reset() [2/2]

template<int N>
void DTTFBitArray< N >::reset ( const int  i)
inline

Definition at line 226 of file DTTFBitArray.h.

226 { this->unset(i); }

References DTTFBitArray< N >::unset().

Referenced by MatrixReader.MatrixReader::__init__(), and MatrixReader.MatrixReader::showRaw().

◆ set() [1/3]

template<int N>
void DTTFBitArray< N >::set ( const int  i)
inline

◆ set() [2/3]

template<int N>
void DTTFBitArray< N >::set ( const int  i,
const char *  str 
)
inline

Definition at line 230 of file DTTFBitArray.h.

230 { this->assign(i, 1, str); }

References DTTFBitArray< N >::assign(), and str.

◆ set() [3/3]

template<int N>
void DTTFBitArray< N >::set ( const int  i,
const int  val 
)
inline

Definition at line 229 of file DTTFBitArray.h.

229 { this->assign(i, 1, val); }

References DTTFBitArray< N >::assign(), and heppy_batch::val.

◆ size()

template<int N>
int DTTFBitArray< N >::size ( void  ) const
inline

Definition at line 118 of file DTTFBitArray.h.

118 { return this->nBits(); }

References DTTFBitArray< N >::nBits().

Referenced by ntupleDataFormat._Collection::__iter__(), and ntupleDataFormat._Collection::__len__().

◆ test()

template<int N>
int DTTFBitArray< N >::test ( const int  i) const
inline

◆ twoComplement() [1/2]

template<int N>
DTTFBitArray<N>& DTTFBitArray< N >::twoComplement ( )
inline

Definition at line 510 of file DTTFBitArray.h.

510  {
511  (*this).flip();
512  (*this)++;
513  return *this;
514  }

◆ twoComplement() [2/2]

template<int N>
DTTFBitArray<N> DTTFBitArray< N >::twoComplement ( ) const
inline

◆ unset()

template<int N>
void DTTFBitArray< N >::unset ( const int  i)
inline

◆ unusedBits()

template<int N>
int DTTFBitArray< N >::unusedBits ( ) const
inline

Definition at line 153 of file DTTFBitArray.h.

153  {
154  if (this->nBits() == 0)
155  return 32;
156  return 31 - ((this->nBits() - 1) % 32);
157  }

References DTTFBitArray< N >::nBits().

Referenced by DTTFBitArray< N >::any(), DTTFBitArray< N >::lastWordMask(), DTTFBitArray< N >::none(), DTTFBitArray< N >::operator<(), and DTTFBitArray< N >::operator==().

◆ zero()

template<int N>
void DTTFBitArray< N >::zero ( )
inline

Definition at line 210 of file DTTFBitArray.h.

210  {
211  for (int i = 0; i < this->nWords(); i++) {
212  _data[i] = 0x0; // set to 0
213  }
214  }

References DTTFBitArray< N >::_data, mps_fire::i, and DTTFBitArray< N >::nWords().

Referenced by DTTFBitArray< N >::DTTFBitArray(), DTTFBitArray< N >::operator=(), and DTTFBitArray< N >::reset().

Friends And Related Function Documentation

◆ refToBit

template<int N>
friend class refToBit
friend

Definition at line 30 of file DTTFBitArray.h.

Referenced by DTTFBitArray< N >::operator[]().

Member Data Documentation

◆ _data

template<int N>
unsigned DTTFBitArray< N >::_data[N/32+1]
private
DTTFBitArray::getPosMask
static unsigned getPosMask(const int pos)
Definition: DTTFBitArray.h:150
DTTFBitArray::_data
unsigned _data[N/32+1]
Definition: DTTFBitArray.h:523
mps_fire.i
i
Definition: mps_fire.py:428
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
DTTFBitArray
Definition: DTTFBitArray.h:28
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
pos
Definition: PixelAliasList.h:18
DTTFBitArray::flip
DTTFBitArray< N > & flip()
Definition: DTTFBitArray.h:403
cms::cuda::assert
assert(be >=bs)
DTTFBitArray::dataWord
unsigned dataWord(const int i) const
Definition: DTTFBitArray.h:124
DTTFBitArray::assign
void assign(const int p, const int n, const int val)
Definition: DTTFBitArray.h:233
EcalTangentSkim_cfg.o
o
Definition: EcalTangentSkim_cfg.py:42
DTTFBitArray::zero
void zero()
Definition: DTTFBitArray.h:210
str
#define str(s)
Definition: TestProcessor.cc:52
N
#define N
Definition: blowfish.cc:9
dqmdumpme.k
k
Definition: dqmdumpme.py:60
DTTFBitArray::cleanUnused
void cleanUnused()
Definition: DTTFBitArray.h:163
a
double a
Definition: hdecay.h:119
DTTFBitArray::test
int test(const int i) const
Definition: DTTFBitArray.h:207
DTTFBitArray::unusedBits
int unusedBits() const
Definition: DTTFBitArray.h:153
DTTFBitArray::getPosInWord
static int getPosInWord(const int pos)
Definition: DTTFBitArray.h:144
DTTFBitArray::lastWordMask
unsigned lastWordMask() const
Definition: DTTFBitArray.h:160
cuy.rep
rep
Definition: cuy.py:1190
DTTFBitArray::nWords
int nWords() const
Definition: DTTFBitArray.h:121
DTTFBitArray::set
void set(const int i)
Definition: DTTFBitArray.h:224
DTTFBitArray::getWord
unsigned & getWord(const int pos)
Definition: DTTFBitArray.h:134
heppy_batch.val
val
Definition: heppy_batch.py:351
DTTFBitArray::element
int element(const int pos) const
Definition: DTTFBitArray.h:206
DTTFBitArray::nBits
int nBits() const
Definition: DTTFBitArray.h:117
DTTFBitArray::unset
void unset(const int i)
Definition: DTTFBitArray.h:225
DTTFBitArray::refToBit
friend class refToBit
Definition: DTTFBitArray.h:30
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31