Deutsch English Français Italiano |
<v2ost6$24rg6$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!npeer.as286.net!npeer-ng0.as286.net!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: jak <nospam@please.ty> Newsgroups: comp.lang.c Subject: Re: Good hash for pointers Date: Fri, 24 May 2024 04:09:41 +0200 Organization: A noiseless patient Spider Lines: 24 Message-ID: <v2ost6$24rg6$1@dont-email.me> References: <v2n88p$1nlcc$1@dont-email.me> <v2on65$200g4$4@dont-email.me> <v2os9o$24mll$1@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 04:09:42 +0200 (CEST) Injection-Info: dont-email.me; posting-host="edf6af0ad51f1a6d490ef5fe4b26a6cc"; logging-data="2256390"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX194/S9zXm8RzfCSQrn8u7kc" User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0 SeaMonkey/2.53.18.2 Cancel-Lock: sha1:dKoHPukC7hUkMXz4VI76uE6d2G4= In-Reply-To: <v2os9o$24mll$1@dont-email.me> Bytes: 2173 Chris M. Thomasson ha scritto: > 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. <https://wiki.osdev.org/Global_Descriptor_Table>