Re: GCC casts short to int

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

 




Andrew Haley wrote:
> 
> 
> Right, so you *must* prevent the overflow.  Why do you need the signed
> overflow anyway?  Can't you use unsigned arithmetic?
> 
> Like this:
> 
>   unsigned int c;
>   unsigned short a = 0;
>   unsigned short b = 0;
> 
> 

Thanks Andrew! That totally did the trick.

I didn't need to use signed arithmetic for my purposes, but I can see why
GCC was so stubborn about converting those short variables to integers.

The assembly code now does the two shifts that I wanted to see.

-- 
View this message in context: http://www.nabble.com/GCC-casts-short-to-int-tp24203223p24204360.html
Sent from the gcc - Help mailing list archive at Nabble.com.


[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