Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TBits.cxx
Go to the documentation of this file.
1// @(#)root/cont:$Id$
2// Author: Philippe Canal 05/02/2001
3// Feb 5 2001: Creation
4// Feb 6 2001: Changed all int to unsigned int.
5
6/** \class TBits
7\ingroup Containers
8Container of bits.
9
10This class provides a simple container of bits.
11Each bit can be set and tested via the functions SetBitNumber and
12TestBitNumber.
13
14The default value of all bits is kFALSE.
15The size of the container is automatically extended when a bit
16number is either set or tested. To reduce the memory size of the
17container use the Compact function, this will discard the memory
18occupied by the upper bits that are 0.
19*/
20
21#include "TBits.h"
22
23#include "TObject.h"
24
25#include <iostream>
26#include <cstring>
27
28
29////////////////////////////////////////////////////////////////////////////////
30/// TBits constructor. All bits set to 0
31
33{
34 if (nbits <= 0) nbits = 8;
35 fNbytes = ((nbits-1)/8) + 1;
37 // this is redundant only with libNew
39}
40
41////////////////////////////////////////////////////////////////////////////////
42/// TBits copy constructor
43
45 fNbytes(original.fNbytes)
46{
49
50}
51
52////////////////////////////////////////////////////////////////////////////////
53/// TBits assignment operator
54
56{
57 if (this != &rhs) {
59 fNbits = rhs.fNbits;
60 fNbytes = rhs.fNbytes;
61 delete [] fAllBits;
62 if (fNbytes != 0) {
64 memcpy(fAllBits,rhs.fAllBits,fNbytes);
65 } else {
66 fAllBits = nullptr;
67 }
68 }
69 return *this;
70}
71
72////////////////////////////////////////////////////////////////////////////////
73/// TBits destructor
74
76{
77 delete [] fAllBits;
78}
79
80////////////////////////////////////////////////////////////////////////////////
81/// Clear the value.
82
83void TBits::Clear(Option_t * /*option*/)
84{
85 delete [] fAllBits;
86 fAllBits = nullptr;
87 fNbits = 0;
88 fNbytes = 0;
89}
90
91////////////////////////////////////////////////////////////////////////////////
92/// Reduce the storage used by the object to a minimun
93
95{
96 if (!fNbits || !fAllBits) return;
98 for(needed=fNbytes-1;
99 needed > 0 && fAllBits[needed]==0; ) { needed--; };
100 needed++;
101
102 if (needed!=fNbytes) {
104 fAllBits = new UChar_t[needed];
105
107 delete [] old_location;
108
109 fNbytes = needed;
110 fNbits = 8*fNbytes;
111 }
112}
113
114////////////////////////////////////////////////////////////////////////////////
115/// Return number of bits set to 1 starting at bit startBit
116
118{
119 static const Int_t nbits[256] = {
120 0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,
121 1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,
122 1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,
123 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
124 1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,
125 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
126 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
127 3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
128 1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,
129 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
130 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
131 3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
132 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
133 3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
134 3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
135 4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8};
136
137 UInt_t i,count = 0;
138 if (startBit == 0) {
139 for(i=0; i<fNbytes; i++) {
140 count += nbits[fAllBits[i]];
141 }
142 return count;
143 }
144 if (startBit >= fNbits) return count;
146 UInt_t ibit = startBit%8;
147 if (ibit) {
148 for (i=ibit;i<8;i++) {
149 if (fAllBits[startByte] & (1<<i)) count++;
150 }
151 startByte++;
152 }
153 for(i=startByte; i<fNbytes; i++) {
154 count += nbits[fAllBits[i]];
155 }
156 return count;
157}
158
159////////////////////////////////////////////////////////////////////////////////
160/// Execute `(*this) &= rhs;`
161/// Extra bits in rhs are ignored
162/// Missing bits in rhs are assumed to be zero.
163
165{
166 UInt_t min = (fNbytes<rhs.fNbytes) ? fNbytes : rhs.fNbytes;
167 for(UInt_t i=0; i<min; ++i) {
168 fAllBits[i] &= rhs.fAllBits[i];
169 }
170 if (fNbytes>min) {
171 memset(&(fAllBits[min]),0,fNbytes-min);
172 }
173}
174
175////////////////////////////////////////////////////////////////////////////////
176/// Execute `(*this) &= rhs;`
177/// Extra bits in rhs are ignored
178/// Missing bits in rhs are assumed to be zero.
179
181{
182 UInt_t min = (fNbytes<rhs.fNbytes) ? fNbytes : rhs.fNbytes;
183 for(UInt_t i=0; i<min; ++i) {
184 fAllBits[i] |= rhs.fAllBits[i];
185 }
186}
187
188////////////////////////////////////////////////////////////////////////////////
189/// Execute `(*this) ^= rhs;`
190/// Extra bits in rhs are ignored
191/// Missing bits in rhs are assumed to be zero.
192
194{
195 UInt_t min = (fNbytes<rhs.fNbytes) ? fNbytes : rhs.fNbytes;
196 for(UInt_t i=0; i<min; ++i) {
197 fAllBits[i] ^= rhs.fAllBits[i];
198 }
199}
200
201////////////////////////////////////////////////////////////////////////////////
202/// Execute `~(*this)`
203
205{
206 for(UInt_t i=0; i<fNbytes; ++i) {
207 fAllBits[i] = ~fAllBits[i];
208 }
209 // NOTE: out-of-bounds bit were also flipped!
210}
211
212////////////////////////////////////////////////////////////////////////////////
213/// Execute the left shift operation.
214/// Note: This does extent the number of bits (i.e. no data loss)
215
217{
218 if (shift==0) return;
219 const UInt_t wordshift = shift / 8;
220 const UInt_t offset = shift % 8;
221 Resize(fNbits + shift);
222 if (offset==0) {
223 for(UInt_t n = fNbytes - 1; n >= wordshift; --n) {
224 fAllBits[n] = fAllBits[ n - wordshift ];
225 }
226 } else {
227 const UInt_t sub_offset = 8 - offset;
228 for(UInt_t n = fNbytes - 1; n > wordshift; --n) {
229 fAllBits[n] = (fAllBits[n - wordshift] << offset) |
230 (fAllBits[n - wordshift - 1] >> sub_offset);
231 }
233 }
235 fNbits += shift;
236}
237
238////////////////////////////////////////////////////////////////////////////////
239/// Execute the left shift operation.
240
242{
243 if (shift==0) return;
244 const UInt_t wordshift = shift / 8;
245 const UInt_t offset = shift % 8;
246 if (fNbytes < (wordshift + 1)) {
248 fNbits = 0;
249 } else {
250 const UInt_t limit = fNbytes - wordshift - 1;
251
252 if (offset == 0)
253 for (UInt_t n = 0; n <= limit; ++n)
255 else {
256 const UInt_t sub_offset = 8 - offset;
257 for (UInt_t n = 0; n < limit; ++n)
258 fAllBits[n] = (fAllBits[n + wordshift] >> offset) |
259 (fAllBits[n + wordshift + 1] << sub_offset);
260 fAllBits[limit] = fAllBits[fNbytes - 1] >> offset;
261 }
262
263 memset(&(fAllBits[limit + 1]), 0, fNbytes - limit - 1);
264 if (fNbits < shift)
265 fNbits = 0;
266 else
267 fNbits -= shift;
268 }
269}
270
271////////////////////////////////////////////////////////////////////////////////
272/// Return position of first null bit (starting from position 0 and up)
273
275{
276 static const Int_t fbits[256] = {
277 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,
278 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,
279 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,
280 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,
281 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,
282 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,
283 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,
284 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,7,
285 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,
286 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,
287 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,
288 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,
289 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,
290 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,
291 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,
292 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,8};
293
294 UInt_t i;
295 if (startBit == 0) {
296 for(i=0; i<fNbytes; i++) {
297 if (fAllBits[i] != 255) return 8*i + fbits[fAllBits[i]];
298 }
299 return fNbits;
300 }
301 if (startBit >= fNbits) return fNbits;
303 UInt_t ibit = startBit%8;
304 if (ibit) {
305 for (i=ibit;i<8;i++) {
306 if ((fAllBits[startByte] & (1<<i)) == 0) return 8*startByte+i;
307 }
308 startByte++;
309 }
310 for(i=startByte; i<fNbytes; i++) {
311 if (fAllBits[i] != 255) return 8*i + fbits[fAllBits[i]];
312 }
313 return fNbits;
314}
315
316////////////////////////////////////////////////////////////////////////////////
317/// Return position of first null bit (starting from position 0 and up)
318
320{
321 static const Int_t fbits[256] = {
322 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
323 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
324 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
325 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
326 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
327 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
328 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
329 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
330 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
331 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
332 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
333 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
334 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
335 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
336 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
337 3,3,3,3,3,3,3,3,2,2,2,2,1,1,0,8};
338
339 UInt_t i;
340 if (startBit>=fNbits) startBit = fNbits-1;
342 UInt_t ibit = startBit%8;
343 if (ibit<7) {
344 for (i=ibit+1;i>0;i--) {
345 if ((fAllBits[startByte] & (1<<(i-1))) == 0) return 8*startByte+i-1;
346 }
347 startByte--;
348 }
349 for(i=startByte+1; i>0; i--) {
350 if (fAllBits[i-1] != 255) return 8*(i-1) + fbits[fAllBits[i-1]];
351 }
352 return fNbits;
353}
354
355////////////////////////////////////////////////////////////////////////////////
356/// Return position of first non null bit (starting from position 0 and up)
357
359{
360 static const Int_t fbits[256] = {
361 8,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
362 4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
363 5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
364 4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
365 6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
366 4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
367 5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
368 4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
369 7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
370 4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
371 5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
372 4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
373 6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
374 4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
375 5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
376 4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0};
377
378 UInt_t i;
379 if (startBit == 0) {
380 for(i=0; i<fNbytes; i++) {
381 if (fAllBits[i] != 0) return 8*i + fbits[fAllBits[i]];
382 }
383 return fNbits;
384 }
385 if (startBit >= fNbits) return fNbits;
387 UInt_t ibit = startBit%8;
388 if (ibit) {
389 for (i=ibit;i<8;i++) {
390 if ((fAllBits[startByte] & (1<<i)) != 0) return 8*startByte+i;
391 }
392 startByte++;
393 }
394 for(i=startByte; i<fNbytes; i++) {
395 if (fAllBits[i] != 0) return 8*i + fbits[fAllBits[i]];
396 }
397 return fNbits;
398}
399
400////////////////////////////////////////////////////////////////////////////////
401/// Return position of first non null bit (starting from position 0 and up)
402
404{
405 static const Int_t fbits[256] = {
406 8,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,
407 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
408 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
409 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
410 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
411 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
412 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
413 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
414 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
415 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
416 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
417 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
418 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
419 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
420 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
421 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7};
422
423 UInt_t i;
424 if (startBit>=fNbits) startBit = fNbits-1;
426 UInt_t ibit = startBit%8;
427 if (ibit<7) {
428 for (i=ibit+1;i>0;i--) {
429 if ((fAllBits[startByte] & (1<<(i-1))) != 0) return 8*startByte+i-1;
430 }
431 startByte--;
432 }
433 for(i=startByte+1; i>0; i--) {
434 if (fAllBits[i-1] != 0) return 8*(i-1) + fbits[fAllBits[i-1]];
435 }
436 return fNbits;
437}
438
439////////////////////////////////////////////////////////////////////////////////
440/// Print the value to the std::ostream
441
442void TBits::Output(std::ostream &os) const
443{
444 for(UInt_t i=0; i<fNbytes; ++i) {
445 UChar_t val = fAllBits[fNbytes - 1 - i];
446 for (UInt_t j=0; j<8; ++j) {
447 os << (Bool_t)(val&0x80);
448 val <<= 1;
449 }
450 }
451}
452
453////////////////////////////////////////////////////////////////////////////////
454/// Once implemented, it will draw the bit field as an histogram.
455/// use the TVirtualPainter as the usual trick
456
458{
459}
460
461////////////////////////////////////////////////////////////////////////////////
462/// Print the list of active bits
463
465{
466 Int_t count = 0;
467 for(UInt_t i=0; i<fNbytes; ++i) {
468 UChar_t val = fAllBits[i];
469 for (UInt_t j=0; j<8; ++j) {
470 if (val & 1) printf(" bit:%4d = 1\n",count);
471 count++;
472 val = val >> 1;
473 }
474 }
475}
476
477////////////////////////////////////////////////////////////////////////////////
478/// Reset all bits to 0 (false).
479
484
485////////////////////////////////////////////////////////////////////////////////
486/// Reverse each bytes.
487
489{
490 if (nbytes > fNbytes) {
491 // do it in this order to remain exception-safe.
493 delete[] fAllBits;
496 }
497}
498
499////////////////////////////////////////////////////////////////////////////////
500/// Set all the bytes.
501
502void TBits::Set(UInt_t nbits, const Char_t *array)
503{
504 UInt_t nbytes=(nbits+7)>>3;
505
507
509 memcpy(fAllBits, array, nbytes);
510}
511
512////////////////////////////////////////////////////////////////////////////////
513/// Copy all the byes.
514
515void TBits::Get(Char_t *array) const
516{
517 memcpy(array, fAllBits, (fNbits+7)>>3);
518}
519
520 #ifdef R__BYTESWAP /* means we are on little endian */
521
522 /*
523 If we are on a little endian machine, a bitvector represented using
524 any integer type is identical to a bitvector represented using bytes.
525 -- FP.
526 */
527
528void TBits::Set(UInt_t nbits, const Short_t *array)
529{
530 // Set all the bytes.
531
532 Set(nbits, (const Char_t*)array);
533}
534
535void TBits::Set(UInt_t nbits, const Int_t *array)
536{
537 // Set all the bytes.
538
539 Set(nbits, (const Char_t*)array);
540}
541
542void TBits::Set(UInt_t nbits, const Long64_t *array)
543{
544 // Set all the bytes.
545
546 Set(nbits, (const Char_t*)array);
547}
548
549void TBits::Get(Short_t *array) const
550{
551 // Get all the bytes.
552
553 Get((Char_t*)array);
554}
555
556void TBits::Get(Int_t *array) const
557{
558 // Get all the bytes.
559
560 Get((Char_t*)array);
561}
562
563void TBits::Get(Long64_t *array) const
564{
565 // Get all the bytes.
566
567 Get((Char_t*)array);
568}
569
570#else
571
572 /*
573 If we are on a big endian machine, some swapping around is required.
574 */
575
576void TBits::Set(UInt_t nbits, const Short_t *array)
577{
578 // make nbytes even so that the loop below is neat.
579 UInt_t nbytes = ((nbits+15)>>3)&~1;
580
582
584
585 const UChar_t *cArray = (const UChar_t*)array;
586 for (UInt_t i=0; i<nbytes; i+=2) {
587 fAllBits[i] = cArray[i+1];
588 fAllBits[i+1] = cArray[i];
589 }
590}
591
592void TBits::Set(UInt_t nbits, const Int_t *array)
593{
594 // make nbytes a multiple of 4 so that the loop below is neat.
595 UInt_t nbytes = ((nbits+31)>>3)&~3;
596
598
600
601 const UChar_t *cArray = (const UChar_t*)array;
602 for (UInt_t i=0; i<nbytes; i+=4) {
603 fAllBits[i] = cArray[i+3];
604 fAllBits[i+1] = cArray[i+2];
605 fAllBits[i+2] = cArray[i+1];
606 fAllBits[i+3] = cArray[i];
607 }
608}
609
610void TBits::Set(UInt_t nbits, const Long64_t *array)
611{
612 // make nbytes a multiple of 8 so that the loop below is neat.
613 UInt_t nbytes = ((nbits+63)>>3)&~7;
614
616
618
619 const UChar_t *cArray = (const UChar_t*)array;
620 for (UInt_t i=0; i<nbytes; i+=8) {
621 fAllBits[i] = cArray[i+7];
622 fAllBits[i+1] = cArray[i+6];
623 fAllBits[i+2] = cArray[i+5];
624 fAllBits[i+3] = cArray[i+4];
625 fAllBits[i+4] = cArray[i+3];
626 fAllBits[i+5] = cArray[i+2];
627 fAllBits[i+6] = cArray[i+1];
628 fAllBits[i+7] = cArray[i];
629 }
630}
631
632void TBits::Get(Short_t *array) const
633{
634 // Get all the bytes.
635
636 UInt_t nBytes = (fNbits+7)>>3;
638
639 UChar_t *cArray=(UChar_t*)array;
640 for (UInt_t i=0; i<nSafeBytes; i+=2) {
641 cArray[i] = fAllBits[i+1];
642 cArray[i+1] = fAllBits[i];
643 }
644
645 if (nBytes>nSafeBytes) {
647 }
648}
649
650void TBits::Get(Int_t *array) const
651{
652 // Get all the bytes.
653
654 UInt_t nBytes = (fNbits+7)>>3;
656
657 UChar_t *cArray=(UChar_t*)array;
658 UInt_t i;
659 for (i=0; i<nSafeBytes; i+=4) {
660 cArray[i] = fAllBits[i+3];
661 cArray[i+1] = fAllBits[i+2];
662 cArray[i+2] = fAllBits[i+1];
663 cArray[i+3] = fAllBits[i];
664 }
665
666 for (i=0; i<nBytes-nSafeBytes; ++i) {
667 cArray[nSafeBytes + (3 - i)] = fAllBits[nSafeBytes + i];
668 }
669}
670
671void TBits::Get(Long64_t *array) const
672{
673 // Get all the bytes.
674
675 UInt_t nBytes = (fNbits+7)>>3;
677
678 UChar_t *cArray=(UChar_t*)array;
679 UInt_t i;
680 for (i=0; i<nSafeBytes; i+=8) {
681 cArray[i] = fAllBits[i+7];
682 cArray[i+1] = fAllBits[i+6];
683 cArray[i+2] = fAllBits[i+5];
684 cArray[i+3] = fAllBits[i+4];
685 cArray[i+4] = fAllBits[i+3];
686 cArray[i+5] = fAllBits[i+2];
687 cArray[i+6] = fAllBits[i+1];
688 cArray[i+7] = fAllBits[i];
689 }
690
691 for (i=0; i<nBytes-nSafeBytes; ++i) {
692 cArray[nSafeBytes + (7 - i)] = fAllBits[nSafeBytes + i];
693 }
694}
695
696#endif
697
699{
700 // Compare object.
701
702 if (fNbits == other.fNbits) {
703 return !memcmp(fAllBits, other.fAllBits, (fNbits+7)>>3);
704 } else if (fNbits < other.fNbits) {
705 return !memcmp(fAllBits, other.fAllBits, (fNbits+7)>>3) && other.FirstSetBit(fNbits) == other.fNbits;
706 } else {
707 return !memcmp(fAllBits, other.fAllBits, (other.fNbits+7)>>3) && FirstSetBit(other.fNbits) == fNbits;
708 }
709}
710
bool Bool_t
Boolean (0=false, 1=true) (bool)
Definition RtypesCore.h:77
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:59
unsigned char UChar_t
Unsigned Character 1 byte (unsigned char)
Definition RtypesCore.h:52
char Char_t
Character 1 byte (char)
Definition RtypesCore.h:51
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int)
Definition RtypesCore.h:60
short Short_t
Signed Short integer 2 bytes (short)
Definition RtypesCore.h:53
long long Long64_t
Portable signed long integer 8 bytes.
Definition RtypesCore.h:83
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
Container of bits.
Definition TBits.h:26
UInt_t fNbytes
Definition TBits.h:31
void DoRightShift(UInt_t shift)
Execute the left shift operation.
Definition TBits.cxx:241
void DoAndEqual(const TBits &rhs)
Execute (*this) &= rhs; Extra bits in rhs are ignored Missing bits in rhs are assumed to be zero.
Definition TBits.cxx:164
Bool_t operator==(const TBits &other) const
Definition TBits.cxx:698
void Resize(UInt_t newlen)
Definition TBits.h:191
void DoXorEqual(const TBits &rhs)
Execute (*this) ^= rhs; Extra bits in rhs are ignored Missing bits in rhs are assumed to be zero.
Definition TBits.cxx:193
void Clear(Option_t *option="") override
Clear the value.
Definition TBits.cxx:83
UInt_t LastNullBit(UInt_t startBit=999999999) const
Return position of first null bit (starting from position 0 and up)
Definition TBits.cxx:319
UInt_t fNbits
Definition TBits.h:30
void ResetAllBits(Bool_t value=kFALSE)
Reset all bits to 0 (false).
Definition TBits.cxx:480
void ReserveBytes(UInt_t nbytes)
Reverse each bytes.
Definition TBits.cxx:488
void DoOrEqual(const TBits &rhs)
Execute (*this) &= rhs; Extra bits in rhs are ignored Missing bits in rhs are assumed to be zero.
Definition TBits.cxx:180
void Print(Option_t *option="") const override
Print the list of active bits.
Definition TBits.cxx:464
void Output(std::ostream &) const
Print the value to the std::ostream.
Definition TBits.cxx:442
void Get(Char_t *array) const
Copy all the byes.
Definition TBits.cxx:515
UInt_t FirstNullBit(UInt_t startBit=0) const
Return position of first null bit (starting from position 0 and up)
Definition TBits.cxx:274
UInt_t FirstSetBit(UInt_t startBit=0) const
Return position of first non null bit (starting from position 0 and up)
Definition TBits.cxx:358
UInt_t CountBits(UInt_t startBit=0) const
Return number of bits set to 1 starting at bit startBit.
Definition TBits.cxx:117
void Compact()
Reduce the storage used by the object to a minimun.
Definition TBits.cxx:94
void DoLeftShift(UInt_t shift)
Execute the left shift operation.
Definition TBits.cxx:216
virtual ~TBits()
TBits destructor.
Definition TBits.cxx:75
UChar_t * fAllBits
Definition TBits.h:32
TBits & operator=(const TBits &)
TBits assignment operator.
Definition TBits.cxx:55
TBits(UInt_t nbits=8)
TBits constructor. All bits set to 0.
Definition TBits.cxx:32
void Paint(Option_t *option="") override
Once implemented, it will draw the bit field as an histogram.
Definition TBits.cxx:457
void DoFlip()
Execute ~(*this)
Definition TBits.cxx:204
void Set(UInt_t nbits, const Char_t *array)
Set all the bytes.
Definition TBits.cxx:502
UInt_t LastSetBit(UInt_t startBit=999999999) const
Return position of first non null bit (starting from position 0 and up)
Definition TBits.cxx:403
Mother of all ROOT objects.
Definition TObject.h:41
TObject & operator=(const TObject &rhs) noexcept
TObject assignment operator.
Definition TObject.h:299
const Int_t n
Definition legend1.C:16