【真心求教】很短的几行ARM汇编,如何看都不懂,跪求转C的代码

【真心求教】很短的几行ARM汇编,怎么看都不懂,跪求转C的代码!
本帖最后由 giter888 于 2013-01-02 09:46:41 编辑




.text:0000099C                 EXPORT EncryptBound
.text:0000099C EncryptBound                            ; CODE XREF: .text:00000FEEp
.text:0000099C                                         ; Java_com_aes_touch_decryptData+34p ...
.text:0000099C                 LSLS    R3, R0, #0x1C   ; Logical Shift Left
.text:0000099E                 BEQ     locret_9AC      ; Branch
.text:000009A0                 ASRS    R3, R0, #0x1F   ; Arithmetic Shift Right
.text:000009A2                 LSRS    R3, R3, #0x1C   ; Logical Shift Right
.text:000009A4                 ADDS    R0, R3, R0      ; Rd = Op1 + Op2
.text:000009A6                 ASRS    R0, R0, #4      ; Arithmetic Shift Right
.text:000009A8                 ADDS    R0, #1          ; Rd = Op1 + Op2
.text:000009AA                 LSLS    R0, R0, #4      ; Logical Shift Left
.text:000009AC
.text:000009AC locret_9AC                              ; CODE XREF: EncryptBound+2j
.text:000009AC                 BX      LR              ; Branch to/from Thumb mode



------解决方案--------------------

typedef unsigned int uint;
int EncryptBound (int r0){
 uint r3;
 r3 = (r0 << 28);
 if(r3){
  r3 = (r0 >> 31);
  r3 >>= 28;
  r0 += r3;
  r0 >>= 4;
  r0++;
  r0 <<= 4;
 }
 return r0;
}