GCC的使用和相关特性。
内置函数
1 |
__builtin_xxx(x) |
GCC includes built-in versions of many of the functions in the standard C library. The versions prefixed with
__builtin_
will always be treated as having the same meaning as the C library function even if you specify the-fno-builtin
option.
函数 | 作用 | 示例 |
---|---|---|
void __builtin___clear_cache (void *begin, void *end) |
刷新指令Cache (iCache), MIPS使用synci 指令 |
|
int __builtin_clz (unsigned int x) |
从最高有效位开始,返回x中前导0位的数量。 如果x为0,则结果未定义 | a = __builtin_clz(5) = 29 |
int __builtin_popcount (unsigned int x) |
返回x中1的个数 | a = __builtin_popcount(5) = 2 |
近期评论