【发布时间】:2012-10-20 06:21:33
【问题描述】:
我正在从源代码编译适用于 x64 的 python 扩展 IGRAPH,而不是发行版中可用的 x86。我已经在 VS 2012 中整理了所有内容,当我在 src/math.c 中注释如下时它会编译
#ifndef HAVE_LOGBL
long double igraph_logbl(long double x) {
long double res;
/**#if defined(_MSC_VER)
__asm { fld [x] }
__asm { fxtract }
__asm { fstp st }
__asm { fistp [res] }
#else
__asm__ ("fxtract\n\t"
"fstp %%st" : "=t" (res) : "0" (x));
#endif*/
return res;
}
#endif
问题是我不太了解 asm,也不太了解从 x86 到 x64 是否存在问题。据我所知,这是 4 个必须转换为 x64 内在函数的汇编指令的简短 sn-p。
有什么建议吗?走向内在是正确的方式吗?还是应该是子程序还是纯C?
编辑:如果有人想查看 igraph 扩展名的链接http://igraph.sourceforge.net/download.html
【问题讨论】:
-
fxtract没有内在函数,因此该计划立即失败。如果您愿意转换非长双精度数,则可以使用 SSE2 内在函数轻松提取指数(顺便说一下,这将比fxtract快得多)。
标签: c++ c assembly visual-studio-2012 intrinsics