> -----Original Message-----
> From: IBM Mainframe Assembler List
> [mailto:[email protected]] On Behalf Of Bill Fairchild
> Sent: Monday, August 23, 2010 1:04 PM
> To: [email protected]
> Subject: Re: Efficient Memory List
>
> Your random input entry is a 32-bit number.  Two to the 32nd
> power is 4GB.  Let the 32-bit number represent the number of
> a bit in a contiguous string of bits that is 4 billion bits
> long.  The number of bytes to contain this array is 537 MB,
> which can easily be acquired above the bar or in a data
> space.  Find the byte address and bit offset within that byte
> that corresponds to the 32-bit input number.  Test the bit.
> If off, you have a new entry, so turn the bit on and process
> the new entry.  If on, you have a duplicate entry, so ignore
> the entry.
>
> Bill Fairchild
> Rocket Software

Assuming truly random distribution of possible keys, couldn't this solution 
possibly cause a fair amount of paging overhead? I really don't know. Was the 
solution left off as an exercise for the reader? <grin> I'd use something like:

        SR      15,15
        L       14,VALUE
        SRDL    14,3    OFFSET TO BYTE CONTAINING BIT TO TEST
        SRL     15,29 BIT NUMBER TO TEST
        L       1,TABLE_ADDRESS
        LLC     2,BIT(15) SET BIT TO TEST INTO R2
        LR      3,2     AND I NEED IT LATER, TOO
        LLC     0,0(15,1) GET BYTE CONTAINING BIT TO TEST
        NR      2,0     TEST BIT
        JNZ     ALREADY_SET
        OR      3,0     SET BIT
        STC     3,0(15,1) UPDATE THE BYTE
...
BIT     DC      AL1(128,64,32,16,8,4,2,1)

The code above is not thread safe (reentrant). I used LLC instead of IC because 
LLC sets the other bits of the register to zero. This is needed for the NR and 
saves an SR instruction to clear reg 0 that an IC would need.

--
John McKown
Systems Engineer IV
IT

Administrative Services Group

HealthMarkets(r)

9151 Boulevard 26 * N. Richland Hills * TX 76010
(817) 255-3225 phone * (817)-691-6183 cell
[email protected] * www.HealthMarkets.com

Confidentiality Notice: This e-mail message may contain confidential or 
proprietary information. If you are not the intended recipient, please contact 
the sender by reply e-mail and destroy all copies of the original message. 
HealthMarkets(r) is the brand name for products underwritten and issued by the 
insurance subsidiaries of HealthMarkets, Inc. -The Chesapeake Life Insurance 
Company(r), Mid-West National Life Insurance Company of TennesseeSM and The 
MEGA Life and Health Insurance Company.SM

Reply via email to