Bit Twiddling
Bit Twiddling
sign = - (num < 0); returns 0 if +ve and -1 if ve to return 1 or -1 result we can have expression like sign = - (num < 0) | 1; 2. sign = num >> (sizeof(int) * CHAR_BIT -1); shifting 31 gives a result -1 for negative number 3.