Which is the simplest way to check if two integers have same sign? Is there any short bitwise trick to do this?
Better way using std::signbit as follows:
std::signbit(firstNumber) == std::signbit(secondNumber);
It also support other basic types (double, float, char etc).
double
float
char