From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Keith David Bershatsky Newsgroups: gmane.emacs.devel Subject: Re: How to quickly compare equality of structs ... Date: Mon, 06 May 2019 16:07:04 -0700 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="78020"; mail-complaints-to="usenet@blaine.gmane.org" Cc: emacs-devel@gnu.org To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue May 07 01:07:54 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hNmi6-000K7G-Mv for ged-emacs-devel@m.gmane.org; Tue, 07 May 2019 01:07:51 +0200 Original-Received: from localhost ([127.0.0.1]:35109 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hNmi5-0003zw-Jf for ged-emacs-devel@m.gmane.org; Mon, 06 May 2019 19:07:49 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:49910) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hNmhR-0003ze-7k for emacs-devel@gnu.org; Mon, 06 May 2019 19:07:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hNmhQ-00040Q-9m for emacs-devel@gnu.org; Mon, 06 May 2019 19:07:09 -0400 Original-Received: from gateway32.websitewelcome.com ([192.185.145.123]:12207) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hNmhQ-000408-0A for emacs-devel@gnu.org; Mon, 06 May 2019 19:07:08 -0400 Original-Received: from cm14.websitewelcome.com (cm14.websitewelcome.com [100.42.49.7]) by gateway32.websitewelcome.com (Postfix) with ESMTP id A87941BAB5 for ; Mon, 6 May 2019 18:07:05 -0500 (CDT) Original-Received: from gator3053.hostgator.com ([50.87.144.69]) by cmsmtp with SMTP id NmhNh9vze2qH7NmhNhRwqv; Mon, 06 May 2019 18:07:05 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lawlist.com ; s=default; h=Content-Type:MIME-Version:Subject:Cc:To:From:Message-ID:Date: Sender:Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=WOFNRVBMc8j0KnnOr5qiVrs4VSIrvl8lNEJlB+qolZ0=; b=l/tvhxQi86tbQyhnkV/YXOvAdx mj0QsSBwl2Kq6UWu9kEcFmbvsYY3eC2kbnYCql5mrkFIjj63BqMMbKkVLKEPrYva/m2yja5ISfk8O sK7F5somQDUcVvnZ/LZ5ReN8Psx/HJ2VP+681WDIDjyv8eficEVjrUBNGviY4a4M8b/wECK+OQd8O FfpWRkSRuXAyrn5XyUYOod4Eg0eTYkyZ+jcikte3LjEHyT3iqh6/joMsYU/Mm7WYwNt4TjVjzzl6d XsZlRinxPHFxzEW21v8316+p4R9J4F8DuaBxRt8umby+nHvZ6R0g/6w94IA14+CDB6PEIFOxlTNeZ EkhqkpWQ==; Original-Received: from cpe-45-48-239-195.socal.res.rr.com ([45.48.239.195]:53539 helo=server.local) by gator3053.hostgator.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.91) (envelope-from ) id 1hNmhN-004J6v-0J; Mon, 06 May 2019 18:07:05 -0500 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator3053.hostgator.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lawlist.com X-BWhitelist: no X-Source-IP: 45.48.239.195 X-Source-L: No X-Exim-ID: 1hNmhN-004J6v-0J X-Source-Sender: cpe-45-48-239-195.socal.res.rr.com (server.local) [45.48.239.195]:53539 X-Source-Auth: lawlist X-Email-Count: 1 X-Source-Cap: bGF3bGlzdDtsYXdsaXN0O2dhdG9yMzA1My5ob3N0Z2F0b3IuY29t X-Local-Domain: yes X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 192.185.145.123 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:236218 Archived-At: Thank you, Paul, for the suggestions. This afternoon, I came across the Cantor's Pairing Function that can be used to create a unique ID for each fake cursor. With that unique ID, I can limit the quantity of comparisons .... n = ((x + y)*(x + y + 1)/2) + y I'll keep working the outline/plan ... ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > Date: [05-06-2019 14:22:37] <6 May 2019 14:22:37 -0700> > From: Paul Eggert > To: Keith David Bershatsky > Cc: emacs-devel@gnu.org > Subject: Re: How to quickly compare equality of structs ... > > On 5/6/19 1:40 PM, Keith David Bershatsky wrote: > > C provides no method for comparing equality of structs > > You can compare each member of the struct yourself. Or you can use > memset to clear all the bytes in the struct (including padding bytes) > before initializing the struct members, and then use memcmp on the result. > > > Based on my limited experience with hash tables in Lisp, I am unable to visualize how I could use such a table in C to do my comparison for each fake cursor .... > > I'm sure there's a way.