Enhancement Request: Adding population count for Integers to the standard image

Richard A. O'Keefe ok at cs.otago.ac.nz
Sun Dec 12 22:36:28 UTC 2004


	Am 10.12.2004 um 13:54 schrieb stéphane ducasse:
	
	> matthew
	>
	> why don't you call your method numberOfZeros? because it is talking 
	> better to me.
	                                                             numberOfOnes
	
	
The reason is simple.
The operation f : natural numbers -> natural numbers
              f x = number of 1s in binary representation of x
is traditionally known as "population count".

POWER 5 instruction set:
	popcntbd RS, RA		"Population Count Byte Doubleword"
Control Data machines
	The instruction was known as "population count" but I've never
	seen a COMPASS manual so don't know the mnemonic.
DEC Alpha
	ctpop Rb.rq,Rc.wq	"Count population; assembler"
	x = _POPCNT(y)		"Population count; C"
SPARC V9
	popc src,dst		"Population Count"

So the chances are that anyone who wants the operation will know it by
the name "population count" and will look for
    (pop|population)(Cnt|Count)
If you think of a non-negative integer as representing a set, then the
name almost makes sense.



More information about the Squeak-dev mailing list