From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 70900 invoked by alias); 8 May 2015 20:18:22 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 70866 invoked by uid 89); 8 May 2015 20:18:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-wi0-f182.google.com Received: from mail-wi0-f182.google.com (HELO mail-wi0-f182.google.com) (209.85.212.182) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 08 May 2015 20:18:18 +0000 Received: by wizk4 with SMTP id k4so42506783wiz.1; Fri, 08 May 2015 13:18:15 -0700 (PDT) X-Received: by 10.180.104.225 with SMTP id gh1mr937718wib.65.1431116295874; Fri, 08 May 2015 13:18:15 -0700 (PDT) Received: from [192.168.0.22] (arf62-1-82-237-250-248.fbx.proxad.net. [82.237.250.248]) by mx.google.com with ESMTPSA id a4sm409898wic.1.2015.05.08.13.18.14 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 May 2015 13:18:14 -0700 (PDT) Message-ID: <554D1A05.9070601@gmail.com> Date: Fri, 08 May 2015 20:18:00 -0000 From: =?UTF-8?B?RnJhbsOnb2lzIER1bW9udA==?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Richard Biener CC: "libstdc++@gcc.gnu.org" , gcc-patches Subject: Re: Enhance std::hash for pointers References: <554A751E.9030009@gmail.com> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-SW-Source: 2015-05/txt/msg00749.txt.bz2 On 08/05/2015 10:02, Richard Biener wrote: > On Wed, May 6, 2015 at 10:10 PM, François Dumont 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