summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/g3dvl/vl_util.c
blob: 2421ae22101ac224eff8c38f514574030aba4b26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include "vl_util.h"
#include <assert.h>

unsigned int vlRoundUpPOT(unsigned int x)
{
	unsigned int i;
	
	assert(x > 0);
	
	--x;
	
	for (i = 1; i < sizeof(unsigned int) * 8; i <<= 1)
		x |= x >> i;
	
	return x + 1;
}