public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "François Dumont" <frs.dumont@gmail.com>
To: Richard Biener <richard.guenther@gmail.com>
Cc: "libstdc++@gcc.gnu.org" <libstdc++@gcc.gnu.org>,
	 gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: Enhance std::hash for pointers
Date: Fri, 08 May 2015 20:18:00 -0000	[thread overview]
Message-ID: <554D1A05.9070601@gmail.com> (raw)
In-Reply-To: <CAFiYyc2asQNBV2_1ezunOnVeVDpDzF5nBE4jyD+2t6PvsPJGYA@mail.gmail.com>

On 08/05/2015 10:02, Richard Biener wrote:
> On Wed, May 6, 2015 at 10:10 PM, François Dumont <frs.dumont@gmail.com> wrote:
>> Hi
>>
>>      Following Marc Glisse comment #4
>> on:https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65641 I would like to
>> propose this enhancement to the hash functor for pointers. It simply gets
>> rid of the irrelevant bits on pointers hash code based on memory alignment
>> of the pointed type. The only drawback I can think of is that the type needs
>> to be complete at std::hash instantiation time but is it really an issue ?
>>
>>      IMO it is quite obvious that the resulting hash code will be better but
> If you use a real hashing function that's not true.  That is, something
> else than GCCs pointer_hash (void *p) { return (uintptr_t)p >>3; }.

Sorry, I don't understand your remark. Do you mean that if someone is 
not using std::hash to hash its pointers he won't benefit from the 
enhancement ?

It is a good point however to see that gcc is using something similar 
internally.

François

  reply	other threads:[~2015-05-08 20:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-06 20:10 François Dumont
2015-05-08  8:02 ` Richard Biener
2015-05-08 20:18   ` François Dumont [this message]
2015-05-08 22:11     ` Christopher Jefferson
2015-05-11 21:06       ` François Dumont

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=554D1A05.9070601@gmail.com \
    --to=frs.dumont@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    --cc=richard.guenther@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).