Getting sign of an integer in Assembly
- by Sagekilla
Hi all, I'm writing some assembly for a project using MASM (32-bit), and I was wondering what would be the easiest way to do this:
int delta = A - B;
int value = floor((delta + sign(delta)) / 2);
Which is basically the following mapping:
For 1 < A < 9, and B = 5:
A = [1, 2] -> -2
A = [3, 4] -> -1
A = [5] -> 0
A = [6, 7] -> +1
A = [8, 9] -> +1
Any help is much appreciated!