在 ARM 汇编中将立即值放入括号中的目的是什么?
这两个指令之间有什么区别(如果有的话)?
subs r2, r2, #(32)
subs r2, r2, #32
括号 ()
的作用是什么?
What, if anything, is the difference between these two instructions?
subs r2, r2, #(32)
subs r2, r2, #32
What are the parentheses ()
for?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
实际上,这些是括号,而不是方括号。
之间没有区别:
我
怀疑
(32)
曾经是类似(32 - 8)
的东西或者当时有趣/有意义/必要的东西,然后“- 8
”被删除,但括号被简单地保留,因为它们没有任何害处。为了完整起见,即使这不是您所要求的&你可能已经知道了:
带“括号”(寄存器间接)的代码
将
r0
加载到r1
中,其地址存储在r1
中——换句话说,如果r1
为1000,r0
将从MEM[1000]加载Actually, those are parentheses, not brackets.
There is no difference between:
and
I suspect the
(32)
used to be something like(32 - 8)
or something that was interesting / meaningful / necessary at the time, then the "- 8
" was removed but the parentheses were simply kept since they do no harm.For the sake of completeness, even though it's not what you asked & you probably already know it:
The code
with "brackets" (register indirect) loads
r0
with the value whose address is stored inr1
-- in other words, ifr1
holds 1000,r0
will be loaded from MEM[1000]