[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] Re: AVR byte swap optimization
From: |
Denis Vlasenko |
Subject: |
[avr-gcc-list] Re: AVR byte swap optimization |
Date: |
Mon, 27 Nov 2006 02:19:56 +0100 |
User-agent: |
KMail/1.8.2 |
On Saturday 18 November 2006 00:30, Shaun Jackman wrote:
> The following macro expands to some rather frightful code on the AVR:
>
> #define BSWAP_16(x) \
> ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))
Sometimes gcc is generating better code if you cast
values instead of masking. Try:
( (uint8_t)((x) >> 8) | ((uint8_t)(x)) << 8 )
--
vda
- [avr-gcc-list] Re: AVR byte swap optimization, (continued)
[avr-gcc-list] Re: AVR byte swap optimization, Rask Ingemann Lambertsen, 2006/11/19
[avr-gcc-list] Re: AVR byte swap optimization,
Denis Vlasenko <=