summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/nouveau/core/include/core/math.h
blob: f808131c5cd87e6077800b7ab08eb0d779cdec95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#ifndef __NOUVEAU_MATH_H__
#define __NOUVEAU_MATH_H__

static inline int
log2i(u64 base)
{
	u64 temp = base >> 1;
	int log2;

	for (log2 = 0; temp; log2++, temp >>= 1) {
	}

	return (base & (base - 1)) ? log2 + 1: log2;
}

#endif