简体   繁体   English

有没有办法在不使用进位标志或 RRX 的情况下在 ARM 汇编语言中对 32 位二进制整数进行位反转?

[英]Is there a way to bit reverse a 32-bit binary integer in ARM Assembly language without using carry flags or RRX?

In the normal way, we would have used LSLS, #1 instruction on the 32-bit binary number where the MSB will be kept in the carry and use RRX to push it back into another register in order to reverse the bits, and we will do this for 32 times.在正常情况下,我们会在 32 位二进制数上使用 LSLS,#1 指令,其中 MSB 将保留在进位中,并使用 RRX 将其推回另一个寄存器以反转位,我们将这样做32次。

But if we are not allowed to RRX specifically and any carry bits, is there another way to reverse the bits?但是,如果我们不允许专门 RRX 和任何进位位,是否有另一种方法来反转这些位?

您已经标记了 Cortex m3(Arm V7-m 架构)和 cortex a8(Arm V7-a 架构),这两者都有rbit指令,可以反转 32 位寄存器中的位。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM