Article View: comp.arch
Article #11783Re: new instructions
From: Christer Ericson
Date: Fri, 24 May 1991 12:24
Date: Fri, 24 May 1991 12:24
19 lines
1494 bytes
1494 bytes
In article <1991May23.204624.22872@shograf.com> jimb@shograf.UUCP (Jim battle) writes: >One place I worked used to ask job applicants to write a program to count >the number of 1's in an integer. Everyone pretty much did the same thing; >see if the number is odd, tally, and shift. One person came up with an >ingenious method that does not involve tables or conditionals. Here is his >solution, given in pseudo assembly language; it assumes 32-bit integers, >although it would work for any word size with little modification: > > [ code deleted] > >As far as I know, this is an original approach; credit goes to Richard Poppen. >I believe he works at Etak. Nope, it isn't really. See Mike Morton's article in the December 1990 issue of Computer Language for numerous ways to count the 1s in an integer. | Christer Ericson Internet: christer@cs.umu.se | | Department of Computer Science, University of Umea, S-90187 UMEA, Sweden |
Technical Details
Message-ID:
<1991May24.122453.11011@cs.umu.se>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!mintaka!bloom-beacon!eru!hagbard!sunic!cs.umu.se!christerReferences:
<24263@lanl.gov> <1991May23.220143.8515@kithrup.COM> <1991May23.204624.22872@shograf.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!mintaka!bloom-beacon!eru!hagbard!sunic!cs.umu.se!christer From: christer@cs.umu.se (Christer Ericson) Newsgroups: comp.arch Subject: Re: new instructions Message-ID: <1991May24.122453.11011@cs.umu.se> Date: 24 May 91 12:24:53 GMT References: <24263@lanl.gov> <1991May23.220143.8515@kithrup.COM> <1991May23.204624.22872@shograf.com> Sender: news@cs.umu.se (News Administrator) Organization: Dep. of Info.Proc, Umea Univ., Sweden Lines: 19