From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,a8c6c308ebb6a246 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!elnk-atl-nf1!newsfeed.earthlink.net!stamper.news.atl.earthlink.net!newsread1.news.atl.earthlink.net.POSTED!14bb18d8!not-for-mail Sender: Matthew Heaney@MHEANEYIBMT43 Newsgroups: comp.lang.ada Subject: Re: hashed_maps References: <1129046337.130908.137510@g47g2000cwa.googlegroups.com> From: Matthew Heaney Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 14 Oct 2005 04:49:18 GMT NNTP-Posting-Host: 24.149.57.125 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.news.atl.earthlink.net 1129265358 24.149.57.125 (Thu, 13 Oct 2005 21:49:18 PDT) NNTP-Posting-Date: Thu, 13 Oct 2005 21:49:18 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: g2news1.google.com comp.lang.ada:5630 Date: 2005-10-14T04:49:18+00:00 List-Id: Robert A Duff writes: > Addresses usually have the low 2 or 3 bits equal to zero, because of > alignment concerns. So use Address_To_Integer and shift right 3 bits. > Then mod by the size of the hash table, or take some high-order bits > and add them into the low-order bits. In the case of the standard hashed containers, I'm not sure you would need to bother, since the mod'ing is done internally by the container. I think you'd only need to right shift if you were to throw away upper bits, say because System.Storage_Elements.Integer_Address has a wider range than Ada.Containers.Hash_Type.