From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.efficios.com (mail.efficios.com [167.114.26.124]) by sourceware.org (Postfix) with ESMTPS id CCCCF3861016 for ; Mon, 10 Aug 2020 19:25:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org CCCCF3861016 Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 7522029E3A6; Mon, 10 Aug 2020 15:25:11 -0400 (EDT) Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id yK-PN88tMgLB; Mon, 10 Aug 2020 15:25:11 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 0775B29E3A5; Mon, 10 Aug 2020 15:25:11 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 0775B29E3A5 X-Virus-Scanned: amavisd-new at efficios.com Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id T63Ss1uo6YLd; Mon, 10 Aug 2020 15:25:10 -0400 (EDT) Received: from [10.0.0.11] (173-246-6-90.qc.cable.ebox.net [173.246.6.90]) by mail.efficios.com (Postfix) with ESMTPSA id C699C29E3A4; Mon, 10 Aug 2020 15:25:10 -0400 (EDT) Subject: Re: [PATCH 4/4] gdb: change regcache list to be a map To: Tom Tromey , Simon Marchi via Gdb-patches Cc: Morichetti@sourceware.org, Laurent References: <20200720204101.2849535-1-simon.marchi@efficios.com> <20200720204101.2849535-5-simon.marchi@efficios.com> <87o8nijos1.fsf@tromey.com> From: Simon Marchi Message-ID: <33ccb191-c428-08e1-ea82-d15dbf6f933b@efficios.com> Date: Mon, 10 Aug 2020 15:25:02 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <87o8nijos1.fsf@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Language: fr Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Aug 2020 19:25:21 -0000 On 2020-08-10 3:15 p.m., Tom Tromey wrote: >>>>>> "Simon" == Simon Marchi via Gdb-patches writes: > > A bit late on this thread, but OTOH nothing too urgent to say... > > Simon> Note: In hash_target_ptid, I am combining hash values from std::hash by > Simon> summing them. I don't think it's ideal, since std::hash is just the > Simon> identity function for base types. But I don't know what would be better > Simon> to reduce the change of collisions. If anybody has a better idea, I'd > Simon> be interested. > > You can use fast_hash iteratively. It may not matter though. > > Simon> +/* Hash function for target_ptid. */ > Simon> + > Simon> +struct hash_target_ptid > Simon> +{ > Simon> + size_t operator() (const target_ptid &val) const > Simon> + { > > It seems to me that for types that have a single "natural" hash, or a > useful "canonical" hash (i.e., a hash we'd be likely to want to use by > default in the normal case), we could specialize std::hash. For > example, this code could do that. Thanks, I'll consider doing these two changes. Simon