Which is the simplest way to check if two integers have same sign? Is there any short bitwise trick to do this?
assuming 32 bit
if(((x^y) & 0x80000000) == 0)
... the answer if(x*y>0) is bad due to overflow
if(x*y>0)