ON 20040125@1:52:37 PM at page: http://www.piclist.commicrochip/math/bit/countbits.htm#38011.5180208333 James Newton[JMN-EFP-786] published post 38011.5180208333 ferrous2@juno.com
For what it's worth, it can be done in nine lines and 51 cycles.|Delete 'P-' before: '' but after: '
clrf sum
movlw 08
moxwf count
loop rrf portx
btfsc status ,c
incf sum
decfsz count
goto loop
rrf portx
Far from elegant, and the highest average cycle count (but constant).