Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site masscomp.UUCP Path: utzoo!watmath!clyde!masscomp!trb From: trb@masscomp.UUCP Newsgroups: net.unix-wizards Subject: Re: HAKMEM Message-ID: <219@masscomp.UUCP> Date: Thu, 8-Mar-84 15:51:34 EST Article-I.D.: masscomp.219 Posted: Thu Mar 8 15:51:34 1984 Date-Received: Fri, 9-Mar-84 02:39:25 EST References: <17256@sri-arpa.UUCP> Organization: MASSCOMP, Littleton, MA Lines: 32 I have my copy right here... ;================================================== ITEM 169 (Gosper, Lenard, Mann, Root): To count the ones in a PDP6/10 word: [numbers in octal, of course -trb] LDB B,[014300,,A] ; or MOVE B,A then LSH B,-1 AND B,[333333,,333333] SUB A,B LSH B,-1 AND B,[333333,,333333] SUBB A,B ; each octal digit is replaced ; by the number of ones in it LSH B,-3 ADD A,B AND A,[070707,,070707] IDIVI A,77 ; casting out 63's ;================================================== I once figured out why this worked. From the MIT AIL bibliography description of HAKMEM: "I keep HAKMEM in the bathroom, it's great reading." -Knuth I think HAKMEM exists on disk at MIT or BBN somewhere. No, you can't have my copy for $1000. Andy Tannenbaum Masscomp Inc Westford MA (617) 692-6200 x274