Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c
Subject: Re: Good hash for pointers
Date: Thu, 23 May 2024 18:39:56 -0700
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <86ed9shtsj.fsf@linuxsc.com>
References: <86v834i1o9.fsf@linuxsc.com> <86r0dshysc.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Date: Fri, 24 May 2024 03:39:57 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="4e2ccf3374e48a9f13e87ba250cb95a8";
logging-data="2244816"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/pVLHoMK96AdOG50/aj/LI1p9esUPRKRI="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:bmxp6hHpq0+RfN3UeGlXA/+GvnA=
sha1:6MAnIAvT+bIvO683i5k9oHXkjJ0=
Bytes: 1921
Malcolm McLean writes:
> On 24/05/2024 00:52, Tim Rentsch wrote:
>
>> Malcolm McLean writes:
>>
>>> On 23/05/2024 23:49, Tim Rentsch wrote:
>>>
>>>> Malcolm McLean writes:
>>>>
>>>>> What is a good hash function for pointers to use in portable
>>>>> ANSI C?
>>>>
>>>> I have a preliminary question. Do you really mean ANSI C, or
>>>> is C99 acceptable?
>>>
>>> C89 is better.
>>> But the pass has been sold.
>>
>> I'm not asking which you think is better. I'm asking about
>> what your requirements are.
>
> C 89.
> I don't want to pull in C99 types and so on just for a hash function.
In that case I think you are stuck with using a half-baked
solution. The standard integer types available in C89 just
aren't a good fit in a 64-bit world.