In languages such as... well anything, both operators for < and <= (and their opposites) exist. Which would be faster, and how are they interpreted?
if (x <= y) { blah; }
or
See Question&Answers more detail:osif (x < y + 1) { blah; }
In languages such as... well anything, both operators for < and <= (and their opposites) exist. Which would be faster, and how are they interpreted?
if (x <= y) { blah; }
or
See Question&Answers more detail:osif (x < y + 1) { blah; }
Assuming no compiler optimizations (big assumption), the first will be faster, as <= is implemented by a single jle
instruction, where as the latter requires an addition followed by a jl
instruction.
http://en.wikibooks.org/wiki/X86_Assembly/Control_Flow#Jump_if_Less