projects
/
coreboot.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
fae2045b9afcbc7fd7b97066e39e1d02c26c0d09
[coreboot.git]
/
src
/
arch
/
i386
/
include
/
bitops.h
1
#ifndef I386_BITOPS_H
2
#define I386_BITOPS_H
3
4
/**
5
* log2 - Find the truncated log base 2 of x
6
*/
7
8
static inline unsigned long log2(unsigned long x)
9
{
10
unsigned long r = 0;
11
__asm__(
12
"bsrl %1, %0\n\t"
13
"jnz 1f\n\t"
14
"movl $-1, %0\n\t"
15
"1:\n\t"
16
: "=r" (r) : "r" (x));
17
return r;
18
19
}
20
#endif /* I386_BITOPS_H */