在寄存器中获取 MSB/LSB [英] Get MSB / LSB in register

查看:45
本文介绍了在寄存器中获取 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?

谢谢!

推荐答案

查看 rbitclz 说明.这些允许您计算 MSB 和 LSB 索引.

Check out the rbit and clz instructions. These allow you to compute the MSB and LSB index.

这篇关于在寄存器中获取 MSB/LSB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆