John McKown wrote Population Count (could somebody explain to me what this might really be used for?).
I find it useful for processing large assembled bit maps. An example is what I call a Marked Days Table. Such an MDT is really a bit map having one bit for each day in some unbroken sequence of full years. The interpretation of individual bit values can vary widely, but for concreteness consider one in which '0'b denotes non-working days and '1'b denotes working days for the Widget Manufacturing Company. Answering such questions as What is the date D that is n working days after the date d? How many working days are there between the dates d and D Can the delivery date D be met for a product that has a production requirement of R days? by accumulating counts of working or non-working days in some interval is made very easy using POPCNT on successive doublewords. (There is a bit-counting example, which can be improved upon, in the current PrOp.) The words 'marked days' of course recall Lewis Carroll's practice of beginning certain of his diary entries with a classical allusion, "I mark this day with a white stone". POPCNT also has some interesting cryptographic/pattern recognition uses. John Gilmore, Ashland, MA 01721 - USA ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
