Re: 3 byte variables [feature request]

David Brown <[email protected]>
Newsgroups gmane.comp.hardware.texas-instruments.msp430.gcc.user
Message-ID <[email protected]>
24-bit integers would have to be 16-bit aligned for the cpu to be able 
to load them efficiently, those negating any storage benefits.  So to be 
able to store them efficiently, you would effectively have a struct 
containing three 8-bit bytes (or an array of three bytes).  I think the 
best you could do here is to make a C++ class containing these three 
bytes, with conversion operations to and from int20_t types.  It should 
be possible to do this with code that is almost as efficient as a real 
gcc implementation.

mvh.,

David


On 05/06/13 16:09, Peter Bigot wrote:
> Best to submit this to the gcc project; it's certainly not something that
> would be added through mspgcc.
>
> int20_t was an enhancement I thought useful since the MSP430 CPUX
> architecture enables it, but I don't have reason to believe other MSP430
> toolchains (including the upcoming RH GCC) will recognize it.  Native
> support for it on CPUX still requires 32-bits when it's written to memory,
> though, and that wouldn't change since its inherent in the way the
> instruction set works.
>
> Peter
>
>
> On Wed, Jun 5, 2013 at 8:53 AM, kuldeep dhaka <[email protected]>wrote:
>
>> while working on a program i faced a problem.
>> i need only 20 bit , and having a 32 bit only waste more memory(12 byte),
>> 24bit would much be better.
>> i need a uint24_t variable but gcc dont support it so i have to start with
>> uint32_t.
>> it would be very nice if gcc support such variables.
>> i tried a little program and found that gcc (on i686) dont support it.
>>
>> http://embeddedgurus.com/stack-overflow/2009/06/three-byte-integers/
>>


------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.