[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [avr-gcc-list] AVR-GCC question
From: |
Trampas |
Subject: |
RE: [avr-gcc-list] AVR-GCC question |
Date: |
Mon, 23 May 2005 16:12:00 -0400 |
I don't think that is portable. That is I know some 16 bit processors and
compilers will report an INT16 as being sizeof 1. That is sizeof for word
addressable machines may report a char as 1 and a 16 bit variable as 1. Thus
sizeof is not always number of bytes, like it is for the X86. Rather sizeof
is the number of smallest storage locations required for the variable.
Regards,
Trampas
-----Original Message-----
From: Jeff Epler [mailto:address@hidden
Sent: Monday, May 23, 2005 3:53 PM
To: Trampas
Cc: address@hidden
Subject: Re: [avr-gcc-list] AVR-GCC question
I understand what you're getting at, but at least one of your problems
can be solved by gcc today. This works (well, I tested on x86 linux
only) and doesn't seem to require any compiler extensions:
#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.
Jeff
- Re: [avr-gcc-list] AVR-GCC question (Harvard Arch and C), (continued)
- Re: [avr-gcc-list] AVR-GCC question (Harvard Arch and C), Joerg Wunsch, 2005/05/23
- Re: [avr-gcc-list] AVR-GCC question, Joerg Wunsch, 2005/05/23
- Re: [avr-gcc-list] AVR-GCC question, Daniel O'Connor, 2005/05/23
- Re: [avr-gcc-list] AVR-GCC question, E. Weddington, 2005/05/23
- Re: [avr-gcc-list] AVR-GCC question, Joerg Wunsch, 2005/05/23
- RE: [avr-gcc-list] AVR-GCC question, Trampas, 2005/05/23
- Re: [avr-gcc-list] AVR-GCC question, E. Weddington, 2005/05/23
- Re: [avr-gcc-list] AVR-GCC question, Matthew MacClary, 2005/05/23
- Re: [avr-gcc-list] AVR-GCC question, Joerg Wunsch, 2005/05/24
- Re: [avr-gcc-list] AVR-GCC question, Jeff Epler, 2005/05/23
- RE: [avr-gcc-list] AVR-GCC question,
Trampas <=
- RE: [avr-gcc-list] AVR-GCC question, Dave Hansen, 2005/05/23
- Re: [avr-gcc-list] AVR-GCC question, Jeff Epler, 2005/05/23
- Re: [avr-gcc-list] AVR-GCC question, Russell Shaw, 2005/05/23
- Re: [avr-gcc-list] AVR-GCC question, Daniel O'Connor, 2005/05/23
RE: [avr-gcc-list] AVR-GCC question, Matt.VanDeWerken, 2005/05/22
[avr-gcc-list] AVR-GCC question, Haase Bjoern (PT-BEU/EMT) *, 2005/05/23
Re: [avr-gcc-list] AVR-GCC question, Klaus Rudolph, 2005/05/23