What's the easiest way to determine if a register's value is equal to zero or not?

后端 未结 3 787
太阳男子
太阳男子 2020-12-06 18:03

I\'m using x86 assembly with the Irvine library.

What\'s the easiest way to check if a register value is equal to zero or not?

I used cmp instruction but i\'

3条回答
  •  孤街浪徒
    2020-12-06 18:43

    You could use:

    or ebx, 0 ;This does nothing, just triggers the zero flag if ebx is zero
    jnz notZero 
    or ebx, 1 ;ebx was zero, then ebx is 1
    notZero:
    

提交回复
热议问题