【发布时间】:2018-11-05 11:20:01
【问题描述】:
我将如何在AT&T Assembly 中使用 and 运算符作为条件执行 if 语句?
assume x = 0x60
assume y = 0x45
例如:
if(x and y)
//do something
这是正确的代码吗?
.globl func
func:
push %r10 //r10 = x
push %r11 //r11 = y
movq $0x60, %r10
movq $0x45, %r11
jmp .loop
.loop:
movq %r10, %r12
and $r11, %r12
cmpq $0xFF, %r12
je .if
jmp .done
.if:
//Do something here
jmp .done
.done:
pop %r10 //r10 = x
pop %r11 //r11 = y
ret
【问题讨论】:
-
您的
and运算符是按位与还是逻辑与?
标签: if-statement assembly conditional-statements operator-keyword