Rich Felker wrote: > Testing which of the three allowable signed integer > representations is used is easy: compare ~(t)1 against and -(t)1 and > -(t)2.
Testing which of the three signed integer representations is in use is not even needed: Your formula ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1) yields the correct result in all three cases. Bruno