Deutsch English Français Italiano |
<v2os9o$24mll$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> Newsgroups: comp.lang.c Subject: Re: Good hash for pointers Date: Thu, 23 May 2024 18:59:19 -0700 Organization: A noiseless patient Spider Lines: 19 Message-ID: <v2os9o$24mll$1@dont-email.me> References: <v2n88p$1nlcc$1@dont-email.me> <v2on65$200g4$4@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 24 May 2024 03:59:21 +0200 (CEST) Injection-Info: dont-email.me; posting-host="a99698c67443521d1279cccaa6d71273"; logging-data="2251445"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/spGYzEv0NJAiHbJscb0UMCbfo0Z/RiYs=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:kUu+GVO6qT2+ses2UFAvL3I6Xc8= In-Reply-To: <v2on65$200g4$4@dont-email.me> Content-Language: en-US Bytes: 1959 On 5/23/2024 5:32 PM, Chris M. Thomasson wrote: > On 5/23/2024 4:11 AM, Malcolm McLean wrote: >> >> What is a good hash function for pointers to use in portable ANSI C? >> >> The pointers are nodes of a tree, which are read only, and I want to >> associate read/write data with them. So potentially a lage number of >> pointers,and they might be consecutively ordered if they are taken >> from an array, or they might be returned from repeared calls to >> malloc() with small allocations. Obviously I have no control over >> pointer size or internal representation. >> > > I kind of remember an old one for 32-bit pointers. It was something like > multiply by a prime and shift to the right by 7 or 8. Shit, I think. It > was way back on comp.programming.threads. There was an old paper from microsoft that had a pointer hash. It was used to index into a table of locks. I need to find it.