Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming > #4021
| From | "osmium" <r124c4u102@comcast.net> |
|---|---|
| Newsgroups | comp.programming |
| Subject | Re: Fast counting of 1-bits of arbitrarily long bit sequences |
| Date | 2013-12-03 10:16 -0600 |
| Message-ID | <bg6eelFb507U1@mid.individual.net> (permalink) |
| References | <l7iish$9p7$1@news.albasani.net> <7q9r99thnsln7i1d09evsdq4c80r4qrvd1@4ax.com> |
"Robert Wessel" wrote: > On Mon, 02 Dec 2013 19:17:55 +0100, Mok-Kong Shen > <mok-kong.shen@t-online.de> wrote: > >> >>Given a n-bit sequence, one may be interested to determine the number >>of 1-bits in it. Decades ago, some computers, e.g. those from CDC, had >>an instruction delivering the bit count of a computer word, which was >>commonly believed to have been specially provided to facilitate some >>crypto studies. A fast software bit counting algorithm for n=32 in C is >>well-known. In the following is a Python code for arbitrary large >>values of n, based on the same idea. Hopefully it could be useful for >>some readers. > > > Many current machines have population count instructions, including > x86, zSeries, PPC/POWER, ARM... (Not all versions, of course). Is there any way to use those instructions in a high-level language such as C without resorting to assembly language?
Back to comp.programming | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Fast counting of 1-bits of arbitrarily long bit sequences Mok-Kong Shen <mok-kong.shen@t-online.de> - 2013-12-02 19:17 +0100
Re: Fast counting of 1-bits of arbitrarily long bit sequences Robert Wessel <robertwessel2@yahoo.com> - 2013-12-03 03:44 -0600
Re: Fast counting of 1-bits of arbitrarily long bit sequences "osmium" <r124c4u102@comcast.net> - 2013-12-03 10:16 -0600
Re: Fast counting of 1-bits of arbitrarily long bit sequences Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-12-03 21:35 +0000
Re: Fast counting of 1-bits of arbitrarily long bit sequences Robert Wessel <robertwessel2@yahoo.com> - 2013-12-03 15:47 -0600
Re: Fast counting of 1-bits of arbitrarily long bit sequences Mok-Kong Shen <mok-kong.shen@t-online.de> - 2013-12-03 17:31 +0100
Re: Fast counting of 1-bits of arbitrarily long bit sequences Robert Wessel <robertwessel2@yahoo.com> - 2013-12-03 15:50 -0600
Re: Fast counting of 1-bits of arbitrarily long bit sequences Mok-Kong Shen <mok-kong.shen@t-online.de> - 2013-12-04 16:03 +0100
csiph-web