As Dmitry K. wrote:
> I have look 'ffs' from newlib (1.12.0). It take up to 800 (!)
> clocks. Reason: shift is included to loop.
The slightly modified BSD code (counter reduced to 8 bits) yields
sbiw r24,0
breq .L1
ldi r18,lo8(1)
.L9:
sbrc r24,0
rjmp .L8
lsr r25
ror r24
subi r18,lo8(-(1))
rjmp .L9
.L8:
mov r24,r18
clr r25
.L1:
ret
This makes 6 clocks per cycle, so up to ~ 100 clocks max.
I'm interested in seeing Dmitry's code...
--
cheers, J"org .-.-. --... ...-- -.. . DL8DTL
http://www.sax.de/~joerg/ NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)
_______________________________________________
AVR-libc-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/avr-libc-dev