开发者

Looking for instruction that flips/reverses bytes in a word

开发者 https://www.devze.com 2023-02-11 05:31 出处:网络
I need to flip/reverse the bytes in a 4-byte word, for the purpose of displaying it 开发者_开发百科on LED display.

I need to flip/reverse the bytes in a 4-byte word, for the purpose of displaying it 开发者_开发百科on LED display.

Apparently there is one simple instruction to accomplish this, but I was unable to find it anywhere.


nor?

nor $d,$s,$t    $d = ~ ($s | $t)

Edit:

Can't seem to find a 32-bit byteswap instruction, but can you byteswap the halfwords and then swap the halfwords?

li   $t0,0xABCD    ;ABCD
wbsh $t0,$t0       ;BADC
rotr $v0,$v0,16    ;DCBA
0

精彩评论

暂无评论...
验证码 换一张
取 消