summaryrefslogtreecommitdiff
path: root/src/misc.cc
blob: 54746fd836001b2d804e751b40a719ebeaf1e448 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include "misc.hh"
#include "glob.hh"

#include <math.h>

int intlog2(int d) {
    int i=0;
    while (!(d&1)) {
	d/= 2; i++;
    }
    assert(!(d/2));
    return i;
}