Which is the simplest way to check if two integers have same sign? Is there any short bitwise trick to do this?
Just off the top of my head...
int mask = 1 << 31; (a & mask) ^ (b & mask) < 0;