Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
09/19/01 05:19
Read: times


 
#15033 - Counting bits
Anyone know of a really fast method of counting bits in a byte?

I was thinking something like:

mov r0, a ; clear bit counter
mov r1, #8 ; loop counter

loop_010:
rrc a ; shift target byte
xch a, r0 ; get bit count
addc a, #0 ;
xch a, r0 ; get target
djnz r1, loop_010

any other ideas?

Also wondering...
What's the best way to generate parity for a 16-bit word using the parity bit in the PSW?


Thanks!
Joe

List of 8 messages in thread
TopicAuthorDate
Counting bits            01/01/70 00:00      
RE: Counting bits            01/01/70 00:00      
RE: Counting bits            01/01/70 00:00      
RE: Counting bits            01/01/70 00:00      
RE: Counting bits            01/01/70 00:00      
RE: Counting bits            01/01/70 00:00      
RE: Counting bits            01/01/70 00:00      
RE: Counting bits            01/01/70 00:00      

Back to Subject List