PDP-8: count number of set bits in a word

Anders Nelson anders.k.nelson at gmail.com
Fri Apr 5 11:56:08 CDT 2019

I suppose you could test each nybble for zero, then equate a 16-element LUT
on nybbles not zero?

Anders Nelson

+1 (517) 775-6129


On Fri, Apr 5, 2019 at 11:59 AM Kyle Owen via cctalk <cctalk at classiccmp.org>

> Just wondering if anyone has come up with a fast way to count the number of
> 1s in a word on a PDP-8. The obvious way is looping 12 times, rotating the
> word through the link or sign bit, incrementing a count based on the value
> of the link or sign.
> With a small lookup table, you can reduce the total number of loops by
> counting multiple groups of bits at a time, but this of course comes with
> the cost of using more memory. Any other suggestions?
> Much appreciated,
> Kyle

More information about the cctech mailing list