Re:Signed Integers Are Two’s Complement
by cornholio on Thursday May 31, 2018 @04:25AM
(#17194830)
My version works up to x = INT_MAX and your version still fails for negative ints, so I don't see the benefit of restricting the range. Getting closer :)
So the compiler optimizable fix is something like: ((x & INT_MAX) * 2) / 2 = x