This is a homework assignment which requires me to come up with a function to determine if x < y, if it is I must return 1, using only bitwise o
x < y
1
In order to know if x < y, you can simply ask if x - y < 0.
x - y < 0
In other words, what is the sign of the result of x - y.
x - y
Since you stated you are to assume 32 bit integers, following will provide the correct result:
((x - y) >> 31) & 0x1