小编mic*_*874的帖子

内联汇编程序导致另一个函数内部冻结

我注意到,使用我的内联汇编代码要么非常慢,要么停止与我的C++代码相比很快完成.当我在一个不同的函数中调用内联汇编程序而不是让函数被调用的汇编程序时,我很好奇为什么会发生这种情况.我测试了两种方法,发现我的程序在省略该功能时没有冻结.

    __asm {

    push dword ptr[rw] //rw is a C++ floating-point variable
    fld[esp] // Using the stack as temporary storage in order to insert it into the FPU
    add esp, 4 //preserving the memory

    push dword ptr[lwB]
    fld[esp]
    add esp, 4

    fsubp ST(1), ST(0) // Subtracting rw - lwB

    push dword ptr[sp]
    fld[esp]
    add esp, 4

    fdivp ST(1), ST(0) // Dividing previous resultant by span -> (rw - lwB) / sp

    push dword ptr[dimen]
    fld[esp]
    add esp, 4

    fmulp ST(1), …
Run Code Online (Sandbox Code Playgroud)

c++ assembly fpu

0
推荐指数
1
解决办法
132
查看次数

标签 统计

assembly ×1

c++ ×1

fpu ×1