MIDAPACK - MIcrowave Data Analysis PACKage  1.1b
Parallel software tools for high performance CMB DA analysis
bitop.c
Go to the documentation of this file.
1 
13 int is_pow_2(int n) { return ((n & -n) ^ n); }
14 
15 
16 int pow_2(int k) {
17  int n = 1;
18  while (k != 0) {
19  n = n << 1;
20  k--;
21  }
22  return n;
23 }
24 
25 
26 int log_2(int n) {
27  int k = 0;
28  while (n != 1 && k < 32) {
29  n = n >> 1;
30  k++;
31  }
32  return k;
33 }
int is_pow_2(int n)
Definition: bitop.c:13
int pow_2(int k)
Definition: bitop.c:16
int log_2(int n)
Definition: bitop.c:26