Help for this page

Select Code to Download


  1. or download this
    ; Assuming condition result is in a flag
    mov eax, i
    lea edx, [rax + 1]    ; edx = i + 1
    cmovnz eax, edx       ; if condition != 0, eax = edx
    mov i, eax
    
  2. or download this
    lea edx, [i + 1]
    test condition, condition
    cmovnz i, edx         ; conditionally move the incremented value
    
  3. or download this
    xor eax, eax
    test condition, condition
    setnz al              ; al = (condition != 0) ? 1 : 0
    add i, eax            ; i += 0 or 1
    
  4. or download this
    ; If your condition sets the carry flag:
    adc i, 0              ; i += carry flag