~ft/hj264

hj264/builtins.c -rw-r--r-- 287 bytes
70b1cf8aSigrid Solveig Haflínudóttir give up on weird shit 4 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
int
__builtin_clz(unsigned int x)
{
	unsigned int r;
	if(x == 0)
		return 32;
	for(r = 0; (x & (1UL<<31)) == 0; x <<= 1, r++);
	return r;
}

unsigned int
__builtin_bswap32(unsigned int x)
{
	return ((x >> 24) & 0xff) | ((x >> 8) & 0xff00) | ((x << 8) & 0xff0000) | ((x & 0xff) << 24);
}