本文介绍了在寄存器中获取MSB/LSB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这似乎是一个愚蠢的问题,但我无法真正说出我所缺少的内容
This might seem like a stupid question, but I cant really tell what I'm missing
在ARM 7上:
我说寄存器0中有一个8位数字
I have a 8 digit number in register 0, say
10110111我想循环浏览并用当前位做一些事情,直到8位上升为止,但是我在解决这个简单问题上遇到了很多麻烦.
I want to 'loop' through this and do something with the current bit until the 8 bits are up, but I'm having alot of trouble with this simple issue..
我的逻辑是:
- get MSB / LSB of number in r0 - shift it to r1 - lsl / lsr r0但是根据这种逻辑,我不知道您将如何获得MSB/LSB.有人可以帮我吗?还是有更好的方法来遍历这一点?
But from this logic, I dont know how you would get the MSB / LSB. Could anyone help me out? Or is there a better way of looping through this?
谢谢!
推荐答案查看rbit和clz指令.这些使您可以计算MSB和LSB索引.
Check out the rbit and clz instructions. These allow you to compute the MSB and LSB index.
更多推荐
在寄存器中获取MSB/LSB
发布评论