获取寄存器中的 MSB/LSB

编程入门 行业动态 更新时间:2024-10-10 07:26:00
本文介绍了获取寄存器中的 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

本文发布于:2023-11-28 21:32:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1644017.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:器中   MSB   LSB

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!