Hi,
I got two question about programming with AVR-GCC. Both are related to
finding a way to generate a specific output in assembler.
First, how do you create the rotate operation in C. Specifically how
can the ROL and ROR can be generated.
Secondly I have this piece of code where b is a 16 bit unsigned integer :
b = b << 1;
if( b & 256 )
b = b ^ 0b100011101;
To optimize that I only need to check if b overflow at the left shift
operation by checking the carry flag. I'm trying to find a way to do
that in C. Right now I'm using the following piece of inline assembly
to do the trick :
asm volatile(
"LSL %0 \n\t"
"BRCC 1f \n\t"
"EOR %0, %1 \n\t"
"1:"" \n\t"
:"+d" (b)
:"r" (PPoly)
);
In this last piece of code b is a 8 bit unsigned integer and PPoly is
a 8 bit unsigned integer with the value 0b00011101. I'm just curious
to know if it's possible to achieve the same result only by using C.
Jonathan Blanchard
_______________________________________________
AVR-GCC-list mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list