Bayeux  3.4.1
Core Foundation library for SuperNEMO
bit_mask.h
Go to the documentation of this file.
1 /* Author(s) : Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date: 2011-02-07
4  * Last modified: 2014-06-23
5  *
6  * License:
7  *
8  * Description:
9  *
10  * Some utilities for manipulating bit masks.
11  *
12  */
13 #ifndef DATATOOLS_BIT_MASK_H
14 #define DATATOOLS_BIT_MASK_H
15 
16 // Third Party
17 // - Boost
18 #include <boost/cstdint.hpp> // IWYU pragma: keep
19 
20 namespace datatools {
21 
25  struct bit_mask {
26  public:
27  static const uint32_t bit00 = 0x00000001;
28  static const uint32_t bit01 = 0x00000002;
29  static const uint32_t bit02 = 0x00000004;
30  static const uint32_t bit03 = 0x00000008;
31  static const uint32_t bit04 = 0x00000010;
32  static const uint32_t bit05 = 0x00000020;
33  static const uint32_t bit06 = 0x00000040;
34  static const uint32_t bit07 = 0x00000080;
35  static const uint32_t bit08 = 0x00000100;
36  static const uint32_t bit09 = 0x00000200;
37  static const uint32_t bit10 = 0x00000400;
38  static const uint32_t bit11 = 0x00000800;
39  static const uint32_t bit12 = 0x00001000;
40  static const uint32_t bit13 = 0x00002000;
41  static const uint32_t bit14 = 0x00004000;
42  static const uint32_t bit15 = 0x00008000;
43  static const uint32_t bit16 = 0x00010000;
44  static const uint32_t bit17 = 0x00020000;
45  static const uint32_t bit18 = 0x00040000;
46  static const uint32_t bit19 = 0x00080000;
47  static const uint32_t bit20 = 0x00100000;
48  static const uint32_t bit21 = 0x00200000;
49  static const uint32_t bit22 = 0x00400000;
50  static const uint32_t bit23 = 0x00800000;
51  static const uint32_t bit24 = 0x01000000;
52  static const uint32_t bit25 = 0x02000000;
53  static const uint32_t bit26 = 0x04000000;
54  static const uint32_t bit27 = 0x08000000;
55  static const uint32_t bit28 = 0x10000000;
56  static const uint32_t bit29 = 0x20000000;
57  static const uint32_t bit30 = 0x40000000;
58  static const uint32_t bit31 = 0x80000000;
59 
60  static const uint32_t nbits00 = 0x00000000;
61  static const uint32_t nbits01 = 0x00000001;
62  static const uint32_t nbits02 = 0x00000003;
63  static const uint32_t nbits03 = 0x00000007;
64  static const uint32_t nbits04 = 0x0000000f;
65  static const uint32_t nbits05 = 0x0000001f;
66  static const uint32_t nbits06 = 0x0000003f;
67  static const uint32_t nbits07 = 0x0000007f;
68  static const uint32_t nbits08 = 0x000000ff;
69  static const uint32_t nbits09 = 0x000001ff;
70  static const uint32_t nbits10 = 0x000003ff;
71  static const uint32_t nbits11 = 0x000007ff;
72  static const uint32_t nbits12 = 0x00000fff;
73  static const uint32_t nbits13 = 0x00001fff;
74  static const uint32_t nbits14 = 0x00003fff;
75  static const uint32_t nbits15 = 0x00007fff;
76  static const uint32_t nbits16 = 0x0000ffff;
77  static const uint32_t nbits17 = 0x0001ffff;
78  static const uint32_t nbits18 = 0x0003ffff;
79  static const uint32_t nbits19 = 0x0007ffff;
80  static const uint32_t nbits20 = 0x000fffff;
81  static const uint32_t nbits21 = 0x001fffff;
82  static const uint32_t nbits22 = 0x003fffff;
83  static const uint32_t nbits23 = 0x007fffff;
84  static const uint32_t nbits24 = 0x00ffffff;
85  static const uint32_t nbits25 = 0x01ffffff;
86  static const uint32_t nbits26 = 0x03ffffff;
87  static const uint32_t nbits27 = 0x07ffffff;
88  static const uint32_t nbits28 = 0x0fffffff;
89  static const uint32_t nbits29 = 0x1fffffff;
90  static const uint32_t nbits30 = 0x3fffffff;
91  static const uint32_t nbits31 = 0x7fffffff;
92  static const uint32_t nbits32 = 0xffffffff;
93  };
94 
95 } // end of namespace datatools
96 
97 #endif // DATATOOLS_BIT_MASK_H
98 
99 // Local Variables: --
100 // mode: c++ --
101 // c-file-style: "gnu" --
102 // tab-width: 2 --
103 // End: --
static const uint32_t bit18
Definition: bit_mask.h:45
static const uint32_t nbits15
Definition: bit_mask.h:75
static const uint32_t nbits16
Definition: bit_mask.h:76
static const uint32_t nbits28
Definition: bit_mask.h:88
static const uint32_t bit08
Definition: bit_mask.h:35
static const uint32_t nbits17
Definition: bit_mask.h:77
static const uint32_t bit07
Definition: bit_mask.h:34
static const uint32_t bit22
Definition: bit_mask.h:49
static const uint32_t bit01
Definition: bit_mask.h:28
static const uint32_t nbits21
Definition: bit_mask.h:81
static const uint32_t bit09
Definition: bit_mask.h:36
static const uint32_t nbits27
Definition: bit_mask.h:87
static const uint32_t bit03
Definition: bit_mask.h:30
static const uint32_t nbits04
Definition: bit_mask.h:64
static const uint32_t bit20
Definition: bit_mask.h:47
static const uint32_t nbits05
Definition: bit_mask.h:65
static const uint32_t nbits08
Definition: bit_mask.h:68
static const uint32_t bit17
Definition: bit_mask.h:44
static const uint32_t nbits13
Definition: bit_mask.h:73
static const uint32_t bit04
Definition: bit_mask.h:31
static const uint32_t bit06
Definition: bit_mask.h:33
static const uint32_t bit31
Definition: bit_mask.h:58
static const uint32_t nbits30
Definition: bit_mask.h:90
static const uint32_t bit23
Definition: bit_mask.h:50
static const uint32_t nbits07
Definition: bit_mask.h:67
static const uint32_t bit27
Definition: bit_mask.h:54
static const uint32_t bit14
Definition: bit_mask.h:41
static const uint32_t nbits12
Definition: bit_mask.h:72
static const uint32_t nbits11
Definition: bit_mask.h:71
static const uint32_t nbits22
Definition: bit_mask.h:82
static const uint32_t bit24
Definition: bit_mask.h:51
static const uint32_t nbits03
Definition: bit_mask.h:63
static const uint32_t bit11
Definition: bit_mask.h:38
static const uint32_t nbits23
Definition: bit_mask.h:83
static const uint32_t bit29
Definition: bit_mask.h:56
static const uint32_t nbits01
Definition: bit_mask.h:61
static const uint32_t nbits02
Definition: bit_mask.h:62
static const uint32_t nbits29
Definition: bit_mask.h:89
static const uint32_t nbits31
Definition: bit_mask.h:91
static const uint32_t nbits32
Definition: bit_mask.h:92
static const uint32_t bit10
Definition: bit_mask.h:37
static const uint32_t nbits14
Definition: bit_mask.h:74
static const uint32_t bit02
Definition: bit_mask.h:29
static const uint32_t bit30
Definition: bit_mask.h:57
static const uint32_t bit05
Definition: bit_mask.h:32
static const uint32_t bit25
Definition: bit_mask.h:52
static const uint32_t nbits06
Definition: bit_mask.h:66
static const uint32_t bit16
Definition: bit_mask.h:43
static const uint32_t nbits09
Definition: bit_mask.h:69
The Bayeux/datatools library top-level namespace.
Definition: algo.h:13
static const uint32_t bit13
Definition: bit_mask.h:40
static const uint32_t nbits26
Definition: bit_mask.h:86
static const uint32_t bit21
Definition: bit_mask.h:48
static const uint32_t bit19
Definition: bit_mask.h:46
Some useful constants to manipulate bits typically within an unsigned integer of 32 bits.
Definition: bit_mask.h:25
static const uint32_t nbits20
Definition: bit_mask.h:80
static const uint32_t nbits10
Definition: bit_mask.h:70
static const uint32_t nbits25
Definition: bit_mask.h:85
static const uint32_t nbits18
Definition: bit_mask.h:78
static const uint32_t bit28
Definition: bit_mask.h:55
static const uint32_t bit00
Definition: bit_mask.h:27
static const uint32_t bit12
Definition: bit_mask.h:39
static const uint32_t bit15
Definition: bit_mask.h:42
static const uint32_t nbits19
Definition: bit_mask.h:79
static const uint32_t nbits24
Definition: bit_mask.h:84
static const uint32_t nbits00
Definition: bit_mask.h:60
static const uint32_t bit26
Definition: bit_mask.h:53