在c ++中集成asm [英] intergrating asm in c++
问题描述
如果我在函数中使用inline asm,请执行以下操作:
void func(){
__asm {
// asm代码
};
};
是否保证这不会破坏注册表? (而不是在C ++代码中使用内联asm的
。)
Cristian
If I am using inline asm in functions, like this:
void func(){
__asm{
// asm code
};
};
is it guaranteed that this does not mess up the registries? (As opposed to
using inline asm in middle of C++ code.)
Cristian
推荐答案
" Cristian Tota" < CR *********** @ vion-software.ro>写在消息中
news:bp ********** @ ally.taide.net ...
"Cristian Tota" <cr***********@vion-software.ro> wrote in message
news:bp**********@ally.taide.net...
如果我在函数中使用内联asm,像这样:
void func(){
__ asm {
// asm code
};
};
是否保证这不会搞砸注册管理机构? (而不是在C ++代码中间使用内联asm。)
If I am using inline asm in functions, like this:
void func(){
__asm{
// asm code
};
};
is it guaranteed that this does not mess up the registries? (As opposed to
using inline asm in middle of C++ code.)
C ++没有注册表的概念,所以你的查询
没有多大意义。
-Mike
C++ has no notion of ''registries'', so your query
doesn''t make much sense.
-Mike
Mike Wahler写道:
Mike Wahler wrote:
Cristian Tota < CR *********** @ vion-software.ro>在消息中写道
新闻:bp ********** @ ally.taide.net ...
"Cristian Tota" <cr***********@vion-software.ro> wrote in message
news:bp**********@ally.taide.net...
如果我在函数中使用inline asm,像这样:
void func(){
__ asm {
// asm code
};
};
是否保证这不会搞砸注册管理机构? (而不是在C ++代码的中间使用内联asm。)
If I am using inline asm in functions, like this:
void func(){
__asm{
// asm code
};
};
is it guaranteed that this does not mess up the registries? (As opposed to
using inline asm in middle of C++ code.)
我对在任何代码中使用asm都很谨慎,你绝对是
肯定需要它。
C ++没有''注册表'的概念,所以你的查询没有多大意义。
I''d be wary about using asm in any code, are you absolutely
sure its needed.
C++ has no notion of ''registries'', so your query
doesn''t make much sense.
OP正在讨论寄存器,而不是注册表(并非所有
来自.ro的海报都有英语作为第一语言)。
The OP is talking about registers, not registries (not all
posters from .ro have English as a first language).
对不起,我记录''注册''(我的第一语言是罗马尼亚语)。
<<我对使用时要小心asm在任何代码中,你是否完全确定它需要
。>>
即使asm代码在函数中被隔离,也会出现问题吗?
我必须做很多位操作,比如将32位变量解码为由位组表示的
值(例如,值
bits [12:15]),交换字节等等。这些都是非常好地使用
asm说明。
Cristian
Sorry, I ment ''registers'' (my first language is Romanian).
<<I''d be wary about using asm in any code, are you absolutely sure its
needed.>>
Could there be problems even if the asm code is isolated in functions?
I have to do a lot of bit operations, like decoding a 32 bit variable into
values represented by groups of bits, (for example the value of
bits[12:15]), swapping the bytes, etc. These would be done very nicely using
the asm instructions.
Cristian
这篇关于在c ++中集成asm的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!