开发者

test byte stored in register mips

What is the best way to test if the byte stored in a reg开发者_运维技巧ister is a letter a-z and A-Z. I tried

blt $t1, 'a', next
blt $t1, 'Z', next

but that didnt work. Any help? PS I am using SPIM to test the code.


Try this:

  blt $t1, 'A', next
  bgt $t1, 'z', next
  ble $t1, 'Z', ok
  blt $t1, 'a', next
ok:
  # code to run if byte in $t1 is a letter
next:
  # code to run if byte in $t1 is a not letter

Basically you need to check the content of the register to be between 'A' and 'Z' or 'a' and 'z'.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜