On 16 March 2014 18:41, Steven Stewart-Gallus wrote: > > Converting an unsigned integer to a signed integer is easy in C. The > implicit conversion works fine. However, converting from a signed > integer to an unsigned integer invokes implementation defined > behaviour (or can raise an implementation defined signal) if "the > value cannot be represented in it". So I wrote some simple code to > convert a uint_fast32_t to an int_fast32_t. Since GCC (and Clang) do what you expect when converting from a signed integer to an unsigned integer, the most optimizer-friendly thing to do is rely on the implementation-defined conversion rather than doing it yourself.