OK - I've done it and the numbers that you were having trouble with are now working.
How I did it was to take the integers into the function unsigned, and the add (unsigned int)(-2147483648) that is (0x8000) to the number.
From there it was easy! Does b-a set the MSB?