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

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

Re: [avr-gcc-list] Structure, bit-fields, optimization...


From: Alexey Boyko
Subject: Re: [avr-gcc-list] Structure, bit-fields, optimization...
Date: Wed, 26 Jun 2002 12:22:14 +0300

Hello Andrej,

AK> I think there has to be more efficient way... like:
AK> *(&tmpStruct.ID + offset) = eeprom_rb(address + offset);
AK> 0<=offset<4
AK> But the second method doesn't work. Any help is appreciated.

Try the following:

((char*)&tmpStruct)[offset] = eeprom_rb(address+offset);

But better this:

eeprom_read_block(&tmpStruct, address, sizeof(tmpStruct));

AK> Also, I would like to know, "how" to program to make code smaller, tips &
AK> tricks are very
AK> welcome.

for example - use less global variables, more locals (if they have
scalar types).

Best regards,
 Alexey                            mailto:address@hidden

avr-gcc-list at http://avr1.org



reply via email to

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