Deutsch English Français Italiano |
<v2vtmh$3go7h$1@raubtier-asyl.eternal-september.org> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail From: Bonita Montero <Bonita.Montero@gmail.com> Newsgroups: comp.lang.c Subject: Re: Good hash for pointers Date: Sun, 26 May 2024 20:06:11 +0200 Organization: A noiseless patient Spider Lines: 16 Message-ID: <v2vtmh$3go7h$1@raubtier-asyl.eternal-september.org> References: <v2n88p$1nlcc$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 26 May 2024 20:06:09 +0200 (CEST) Injection-Info: raubtier-asyl.eternal-september.org; posting-host="861c1998cc926dd42c778978d59780b8"; logging-data="3694833"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19yPrLUvtKNbXGC9KsV4eobYp+jp9Xckg0=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:2Hszs0PdFXCwkgawaFkFdClAOSc= In-Reply-To: <v2n88p$1nlcc$1@dont-email.me> Content-Language: de-DE Bytes: 1868 Am 23.05.2024 um 13:11 schrieb Malcolm McLean: > > 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. > Can you explain this ? The only puropose of what I'm aware why hashing pointers makes sense is taking them as keys for an API talking to exter- nal code. And an operating system kernel could take pointers as handles and verify if they're legal with a hashtable lookup.