Please explain syntax for (X ^ (X >> 31)) - (X >> 31)

Hi could someone please explain in very very basic terms (or direct me to tutorial) what is happening in this syntax:

(X ^ (X >> 31)) - (X >> 31)

this was part of and example on how to optimist code (posted in this forum awhile ago), specifically for replacing either:

Math.abs(X);

or

X<0 ? -X : X;

I understand how the brackets work, and that X is a variable (I presume a Number).
I assume that ‘^’ == ‘to the power of’.
I dont understand why they are using >> or 31 at all.

Thanks for your time,
S.