Re: How can I make this code friendly to GCC's optimizer?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux