avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] AVR-GCC question


From: Jeff Epler
Subject: Re: [avr-gcc-list] AVR-GCC question
Date: Mon, 23 May 2005 16:06:52 -0500
User-agent: Mutt/1.5.9i

On Mon, May 23, 2005 at 04:47:08PM -0400, Dave Hansen wrote:
> [...]
> >-----Original Message-----
> >From: Jeff Epler [mailto:address@hidden
> [...]
> >#include <limits.h>
> >#define MAX_SIGNED(x) (double)((1ull<<(CHAR_BIT * sizeof(x) - 1))-1)
> >
> >Using this macro, though, the signed char -128 goes to a value below
> >-1.0.  I think that's the same thing your code did.
> 
> ?
> 
> If x is a signed char, then sizeof(x) == 1.  Always.  Regardless of the 
> value of x.

If CHAR_BIT == 8, then MAX_SIGNED(char) == 127.0, but -128/127 is -1.008...

Jeff

Attachment: pgpiWaEH94twh.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]