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

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

RE: [avr-gcc-list] 24 bit Integer


From: Dave Hansen
Subject: RE: [avr-gcc-list] 24 bit Integer
Date: Thu, 31 Jul 2008 00:46:12 -0400

For a PDP-8, CHAR_BIT would be 12, int could have 24 bits, and long could have 
36 or 48, whatever is most convenient/efficient/desired.  

For a PDP-15, char and int could be the same 18-bit type, and long could be 36 
bits.

On further reflection, you might be able to replace the standard 16 bit int on 
AVR with a 24 bit int.  The required ranges are minimums.  That makes int16_t a 
special type outside the normal hierarchy, however, and I'm not certain that's 
allowed.

Regards,

   -=Dave



________________________________

From: address@hidden
[...]
what about a PDP 8 or PDP 15,  could we not code for it?   being 12 and 18 bit 
machines?


From: address@hidden

> 2008/7/14 Weddington, Eric <address@hidden>:
>> A 24-bit integer is not supported by the C language. In theory, support
>> could be added to GCC, but then it would be considered an extension to
>> the C language. And it would also be difficult and/or time-consuming to
>> add to GCC.
>
> The C standard doesn't dictate the size of any integer type, except that char
> must be large enough to hold the environments standard character set and
> the size of any larger types is ordered as you'd expect.
> char <= short <= int <= long

Also that short and int must be able to represent at least -32767 to +32767, 
and long must be able to represent +/-2,147,483,647.  So int24_t would have to 
be a special type outside the standard types.

And I think (though I'm not certain) that it would have to be promoted to long 
before any operator could be applied.  Some of that would be mitigated by the 
as-if rule, of course...

> int is typically the natural word size for the architecture, but often on 8 
> bit
> micros it will be larger (since char typically provides an 8 bit int anyway.)

It's larger because an 8 bits can't represent the required range of values.

Regards,

   -=Dave



________________________________

Time for vacation? WIN what you need. Enter Now! 
_______________________________________________
AVR-GCC-list mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list


_________________________________________________________________
With Windows Live for mobile, your contacts travel with you.
http://www.windowslive.com/mobile/overview.html?ocid=TXT_TAGLM_WL_mobile_072008



reply via email to

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