How is the ">" operator implemented (on 32 bit integers)?
- by Ron Klein
Let's say that the environment is x86.
How do compilers compile the "" operator on 32 bit integers.
Logically, I mean. Without any knowledge of Assembly.
Let's say that the high level language code is:
int32 x, y;
x = 123;
y = 456;
bool z;
z = x > y;
What does the compiler do for evaluating the expression x > y?
Does it perform something like (assuming that x and y are positive integers):
w = sign_of(x - y);
if (w == 0)
// expression is 'false'
else if (w == 1)
// expression is 'true'
else
// expression is 'false'
Is there any reference for such information?