ARM位字段提取? [英] ARM bit field extract?

查看:285
本文介绍了ARM位字段提取?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人能解释该指令做什么,并把它翻译为C?

Can someone explain what this instruction does and translate it to C?

ubfx.w          r3, r11, #0xE, #1

据ARM的参考手册,它做了符号和无符号位字段提取的,但我不擅长与所有的按位的东​​西。

According to the ARM reference manual, it does a "signed and unsigned bit field extract" but I'm not good with all that bitwise stuff.

推荐答案

UBFX刚刚从源寄存器中提取一个位域,并将其放入目标寄存器的最低显著位。

UBFX just extracts a bitfield from the source register and puts it in the least significant bits of the destination register.

的一般形式是:

UBFX dest, src, lsb, width

这用C是:

dest = (src >> lsb) & ((1 << width) - 1);

这个例子的等价的C你给是:

The C equivalent of the example you give would be:

r3 = (r11 >> 14) & 1;

即。 R3为1,如果R11的第14位被置位,否则为0。

i.e. r3 will be 1 if bit 14 of r11 is set, otherwise it will be 0.

请参阅:的http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0489c/Cjahjhee.html

这篇关于ARM位字段提取?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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