bit_test.cc
Go to the documentation of this file.
2 #include <cstdlib>
3 
4 using cet::bit_number;
5 using cet::bit_size;
6 using cet::circ_lshift;
7 using cet::left_bits;
8 using cet::right_bits;
9 
10 void
11 ensure(int which, bool claim)
12 {
13  if (not claim)
14  std::exit(which);
15 }
16 
17 int
19 {
20  typedef unsigned int uint;
21  typedef unsigned long ulong;
22 
23  ensure(1, bit_size<uint>::value == sizeof(uint) * 8);
24  ensure(2, bit_size<ulong>::value == sizeof(ulong) * 8);
25 
29 
33 
34  ensure(11,
36  ensure(12,
38  ensure(13,
40 
41  for (uint k = 0, pow2 = 1; k != bit_size<uint>::value; ++k, pow2 *= 2)
42  ensure(21 + k, circ_lshift(1u, k) == pow2);
43 
44  return 0;
45 
46 } // main()
int main()
Definition: bit_test.cc:18
void ensure(int which, bool claim)
Definition: bit_test.cc:11
unsigned long ulong
Definition: qglobal.h:352
struct bit_size<U>.
unsigned uint
Definition: qglobal.h:351