Functions
bit_test.cc File Reference
#include "cetlib/bit_manipulation.h"
#include <cstdlib>

Go to the source code of this file.

Functions

void ensure (int which, bool claim)
 
int main ()
 

Function Documentation

void ensure ( int  which,
bool  claim 
)

Definition at line 11 of file bit_test.cc.

12 {
13  if (not claim)
14  std::exit(which);
15 }
int main ( void  )

Definition at line 18 of file bit_test.cc.

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()
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