Re: 3 byte variables [feature request]

Peter Bigot <[email protected]>
Newsgroups gmane.comp.hardware.texas-instruments.msp430.gcc.user
Message-ID <CAPOJ94MHPfc84X8ouK8FWVFvWQaEn6cWVd05MgRSrO9=bq-MVg@mail.gmail.com>
Keep in mind that, even with a "real gcc implementation", that code would
still be very inefficient due to weaknesses in the MSP430 CPUX instruction
set.  Getting the upper 4 bits into and out of a 20-bit register is a
computationally complex operation.  The best approach I've found that
doesn't require a word-aligned memory location involves a 5-bit
rotate-through-carry.  Casts between 32-bit and 20-bit values on the MSP430
are extremely expensive.


On Wed, Jun 5, 2013 at 3:22 PM, David Brown <[email protected]>wrote:

>
> 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/<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

_______________________________________________
Mspgcc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
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.