在cython中调用gcc内置?

Chi*_*nke 4 c gcc cython

我想在cython sourcefile()中调用gcc内置函数,例如__builtin_ffs.pyx

cpdef int ffs(long b):
    return __builtin_ffs(b);
Run Code Online (Sandbox Code Playgroud)

可能吗?如果是这样,怎么样?

Jon*_*sen 5

简单地将内置声明声明为外部函数(http://docs.cython.org/src/userguide/external_C_code.html)

cdef extern int __builtin_ffs(unsigned int x)
Run Code Online (Sandbox Code Playgroud)

由于__builtin_ffs未出现在任何头文件中,因此不必使用该extern from "header.h"构造.不用说,该模块将仅使用知道的编译器构建__builtin_ffs.