bitcount32: replace lengthy comment with SWAR reference

Stefan Bethke stb at lassitu.de
Sat May 7 21:19:17 UTC 2011


Am 07.05.2011 um 22:59 schrieb Andriy Gapon:

> on 07/05/2011 23:22 Stefan Bethke said the following:
>> 
>> Am 07.05.2011 um 12:47 schrieb Kostik Belousov:
>> 
>>> On Sat, May 07, 2011 at 12:58:11PM +0300, Andriy Gapon wrote:
>>>> 
>>>> I think that the SWAR reference should be more concise and should lead an
>>>> interested reader to more information on the topic (and more up-to-date as well).
>>>> 
>>> SWAR acronim seems to be a wikipedia invention. Without the abbreviation,
>>> the trimmed down comment looks better, IMHO.
>> 
>> How about a proper reference, for example Warren's Hackers Delight (p. 65)?
> 
> Hm, what makes that reference proper or more (most) proper?
> My top google results for SWAR seem to point to materials created by inventors
> of the algorithm.

Your google-fu is clearly superior.  It took me a couple tries to find the page you're refering to.

http://aggregate.org/MAGIC/#Population%20Count%20%28Ones%20Count%29

Why not put a link in there directly?  I just prefer a reference I can actually look up over an acronym that (by itself) cannot easily be resolved.

The algorithm itself seems to predate SWAR significantly: according to Hackers Delight, it was described in /Combinatorial Algorithms: Theory and Pratice/ in 77.

The code in systm.h appears to be a slightly less optimized version of the algorithm presented in SWAR or Hacker's Delight.


Stefan 

-- 
Stefan Bethke <stb at lassitu.de>   Fon +49 151 14070811





More information about the freebsd-current mailing list