Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Malcolm McLean Newsgroups: comp.lang.c Subject: Good hash for pointers Date: Thu, 23 May 2024 12:11:19 +0100 Organization: A noiseless patient Spider Lines: 13 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 23 May 2024 13:11:21 +0200 (CEST) Injection-Info: dont-email.me; posting-host="e36bb85b3458d7387a4e967badf9d4df"; logging-data="1824140"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/LMrItEpygsvUSsdMUYLZTI2DftQh9n/U=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:f1UjboOcy8rREb963T6Lnq73ex4= Content-Language: en-GB Bytes: 1451 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. -- Check out Basic Algorithms and my other books: https://www.lulu.com/spotlight/bgy1mm