Skip to content

Latest commit

 

History

History
38 lines (19 loc) · 463 Bytes

File metadata and controls

38 lines (19 loc) · 463 Bytes

Question 34

How to check whether an integer number is contained in a certain range $(x,y)$?

Answer

Check if it is smaller than $x$ or greater than $y$. Otherwise it is in range.

; Check if rax is between 13 and 42 

mov rax, 20

cmp rax, 42
jg _no
cmp rax, 13
jl _no

_yes:
; in this branch, we are sure that 13 <= rax <= 42
; ...

_no:
; in this branch, we are sure that rax < 13 or rax > 42
; ...

prev +++ next