如何使用IA32汇编语言检查单词某个位置的某位是否为1?
答案 0 :(得分:4)
Test
,类似于:
value = 000100h
mov eax, your_word
test eax, value
jnz was_set
答案 1 :(得分:2)
NASM:
bt ax, <POS> ; test if bit at position is set: 1 means carry will be set 0 means carry will be unset
adc eax, 0 ; add 0 + carry to eax
您还可以使用jc
(跳转进位设置)jnc
(跳转进位未设置)