Author tim.peters
Recipients Jim Fasarakis-Hilliard, mark.dickinson, niklasf, serhiy.storchaka, tim.peters
Date 2017-03-22.22:00:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1490220039.01.0.937350375479.issue29882@psf.upfronthosting.co.za>
In-reply-to
Content
See also:

    https://en.wikipedia.org/wiki/Hamming_weight

As that says, there are a number of languages and processors with first class support for a popcount function.  I've frequently implemented it in Python when using integers as integer bitsets (`i` is in the set if and only if bit `2**i` is set in the integer), which often - except for finding the cardinality - runs much faster than using general Python sets.
History
Date User Action Args
2017-03-22 22:00:39tim.peterssetrecipients: + tim.peters, mark.dickinson, serhiy.storchaka, Jim Fasarakis-Hilliard, niklasf
2017-03-22 22:00:39tim.peterssetmessageid: <1490220039.01.0.937350375479.issue29882@psf.upfronthosting.co.za>
2017-03-22 22:00:38tim.peterslinkissue29882 messages
2017-03-22 22:00:38tim.peterscreate