Author: Bruce Moreland
Date: 02:32:03 08/20/99
Go up one level in this thread
On August 19, 1999 at 18:12:35, Johannes Buchner wrote:
>Hi there !
>
>I just wanted to know if anybody out there knows a different way how to do this
>than using table-lookups like crafty. Is really no other mathematical
>possibility ? By the way, do you know any Internet resources that deal with
>problems like this (I think there is a method to do popcount without
>table-lookups, e.g.) ? In the 'Dark Thought' description they're talking about
>'Hacker's memory', a 'well-known collection of programming tricks'. Ever heard
>of it ? I haven't !
>So if you know anything intersting about that topic, please let me know (and all
>the otherz of course !)
Population count is a very well considered problem, and there are numerous ways
to do it. I think that choosing a "best" way to do it has a lot to do with
machine architectures, ease of access to low-level instructions, and the
character of the data you are counting.
For instance, if you know your data is composed of nothing but the values "0"
and "1", the fastest function is probably:
int PopCountOneOrZero(int n)
{
return n;
}
Obviously an absurd case but you get the point I hope.
bruce
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.