[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to quickly compare equality of structs ...
From: |
Keith David Bershatsky |
Subject: |
Re: How to quickly compare equality of structs ... |
Date: |
Mon, 06 May 2019 16:07:04 -0700 |
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 <address@hidden>
> To: Keith David Bershatsky <address@hidden>
> Cc: address@hidden
> 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.