Re: code questions.

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

 



On Mon, Jun 2, 2008 at 10:04 PM, Scott Phuong <mycleanjunk@xxxxxxxxx> wrote:
> Thanks so much for your quick reply. This code is simliar to code in a
> third party source code that I have to fix and they do this all over
> the place. The question is w/o touching their code is there a way I
> can fix this?

Switch to a platform with 16-bit ints?

> I tried explicitly casting the 1 to an unsigned short
> but it doesn't seem to work like this:
>
> a = (a + (unsigned short) 1) % b.
>

More evidence that you're hitting integral promotion, so there's
basically nothing you can do about it.

(Besides make sure a is never that large :P)

[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