cgccx86carryflageflags

check if carry flag is set


Using inline assembler [gcc, intel, c], how to check if the carry flag is set after an operation?


Solution

  • With conditional jumps jc (jump if carry) or jnc (jump if not carry).

    Or you can store the carry flag,

    ;; Intel syntax
    mov eax, 0
    adc eax, 0 ; add with carry