How can I tell if a number is a multiple of four using only the logic operator AND?

后端 未结 4 1979
终归单人心
终归单人心 2020-12-30 12:41

I\'m messing with assembly language programming and I\'m curious how I could tell if a number is a multiple of 4 using the logic operator AND?

I know how to do it us

4条回答
  •  借酒劲吻你
    2020-12-30 13:28

    In x86 assembly:

        test eax, 3
        jnz not_multiple_of_4
    
        ; action to be taken if EAX is a multiple of 4
    
    not_multiple_of_4:
        ; ...
    

提交回复
热议问题