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 www.erogear.com On Fri, Apr 5, 2019 at 11:59 AM Kyle Owen via cctalk <cctalk@classiccmp.org> wrote: > 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 >