Here's the question
I thought of shifting to the right by 31 to grab the sign bit but can't 0 be positive AND negative technically?
You may try like this for 32 bit int:-
32 bit int
(x >> 31) | (((~x + 1) >> 31) & 1)