Hi Lawrence,
I tried to compile the following code in CCS:
i = i/32;
i >>= 5;
and got:
.................... i=i/32;
RRF 26,F
RRF 25,F
RRF 26,F
RRF 25,F
RRF 26,F
RRF 25,F
RRF 26,F
RRF 25,F
RRF 26,F
RRF 25,F
MOVLW 07
ANDWF 26,F
.................... i >>= 5;
RRF 26,F
RRF 25,F
RRF 26,F
RRF 25,F
RRF 26,F
RRF 25,F
RRF 26,F
RRF 25,F
RRF 26,F
RRF 25,F
MOVLW 07
ANDWF 26,F
which already are very efficient.
regards,
Reggie
--
e-mail: rberdin
KILLspambigfoot.com
ICQ#: 31651436
URL: http://www.bigfoot.com/~rberdin
Peter Homann wrote:
{Quote hidden}>
> Hi Lawrence,
> long data;
> byte x;
>
> for (x = 0; x < 5; x++)
> {
> shift_right(&data,2,0);
> }
>
> or the normal C method.
>
> long data;
>
> data = data >>5;
>
> is the same as
>
> long data;
>
> data >>= 5;
>
> regards,
>
> Peter.
> ---