在伪代码没问题的情况下,尽量还是用伪代码,方便快捷
-参考:https://www.jianshu.com/p/66d801c85ee9
存储时是按q0的类型存储的,q0是16字节,就要存储16字节
EXTR W5, W21, W21, #0x17
->ror w5, w21, #0x17
NEG w23,w3
->w23=-w3
bic r0, r0, #6
->r0=r0&(~6)
32bits下等效代码
uint32_t bswap32(uint32_t s) {
return ((s << 24) & 0xff000000) |
((s << 8) & 0x00ff0000) |
((s >> 8) & 0x0000ff00) |
((s >> 24) & 0x000000ff);
}
32bits下等效代码
//_DWORD __ROR4__(_DWORD a,char b);
//循环右移count位
inline uint32_t __ROR4__(uint32_t value, int count) {
int offset = count % 32;
if (offset < 0)offset = 32 + offset;
if (offset >= 1 && offset <= 31) {
return (value >> offset) | (value << (32 - offset));
} else if (offset == 0 || offset == 32) {
return value;
}
exit(100);
}
声明:转载请注明出处,原文地址:shlu's note